1 // RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s 2 3 // A glvalue of type "cv1 T1" can be cast to type "rvalue reference to 4 // cv2 T2" if "cv2 T2" is reference-compatible with "cv1 T1" (8.5.3). 5 struct A { }; 6 struct B : A { }; 7 8 template<typename T> T& lvalue(); 9 template<typename T> T&& xvalue(); 10 test(A & a,B & b)11void test(A &a, B &b) { 12 A &&ar0 = static_cast<A&&>(a); 13 A &&ar1 = static_cast<A&&>(b); 14 A &&ar2 = static_cast<A&&>(lvalue<A>()); 15 A &&ar3 = static_cast<A&&>(lvalue<B>()); 16 A &&ar4 = static_cast<A&&>(xvalue<A>()); 17 A &&ar5 = static_cast<A&&>(xvalue<B>()); 18 const A &&ar6 = static_cast<const A&&>(a); 19 const A &&ar7 = static_cast<const A&&>(b); 20 const A &&ar8 = static_cast<const A&&>(lvalue<A>()); 21 const A &&ar9 = static_cast<const A&&>(lvalue<B>()); 22 const A &&ar10 = static_cast<const A&&>(xvalue<A>()); 23 const A &&ar11 = static_cast<const A&&>(xvalue<B>()); 24 } 25