p1-0x.cpp revision 8e8fb3be5bd78f0564444eca02b404566a5f3b5d
1// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s 2// expected-no-diagnostics 3 4// The result of the expression const_cast<T>(v) is of type T. If T is 5// an lvalue reference to object type, the result is an lvalue; if T 6// is an rvalue reference to object type, the result is an xvalue;. 7 8unsigned int f(int); 9 10template<typename T> T& lvalue(); 11template<typename T> T&& xvalue(); 12template<typename T> T prvalue(); 13 14void test_classification(const int *ptr) { 15 int *ptr0 = const_cast<int *&&>(ptr); 16 int *ptr1 = const_cast<int *&&>(xvalue<const int*>()); 17 int *ptr2 = const_cast<int *&&>(prvalue<const int*>()); 18} 19