1 // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
3 // If T is an lvalue reference type or an rvalue reference to function
4 // type, the result is an lvalue; if T is an rvalue reference to
5 // object type, the result is an xvalue;
9 template<typename T
> T
&& xvalue();
10 void test_classification(char *ptr
) {
11 int (&fr0
)(int) = reinterpret_cast<int (&&)(int)>(f
);
12 int &&ir0
= reinterpret_cast<int &&>(*ptr
);
13 int &&ir1
= reinterpret_cast<int &&>(0); // expected-error {{rvalue to reference type}}
14 int &&ir2
= reinterpret_cast<int &&>('a'); // expected-error {{rvalue to reference type}}
15 int &&ir3
= reinterpret_cast<int &&>(xvalue
<char>());
16 // Per DR1268, reinterpret_cast can convert between lvalues and xvalues.
17 int &ir4
= reinterpret_cast<int &>(xvalue
<char>());
18 int &&ir5
= reinterpret_cast<int &&>(*ptr
);