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