Home | History | Annotate | Download | only in expr.const.cast
      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 
      7 unsigned int f(int);
      8 
      9 template<typename T> T& lvalue();
     10 template<typename T> T&& xvalue();
     11 template<typename T> T prvalue();
     12 
     13 void 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