summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp0x/rv-cast2.C
blob: 94ee4ca849e26af4596aa73fb2268de660489ed6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Test for const_cast to reference (5.2.11/4).
// { dg-options -std=c++0x }

template <class T> T&& xval();
template <class T> T& lval();
template <class T> T prval();

struct A { };

int main()
{
  const_cast<int&>(lval<int>());
  const_cast<int&>(xval<int>());   // { dg-error "" }
  const_cast<int&>(prval<int>());  // { dg-error "" }
  const_cast<int&&>(lval<int>());
  const_cast<int&&>(xval<int>());
  const_cast<int&&>(prval<int>()); // { dg-error "" }
  const_cast<A&&>(lval<A>());
  const_cast<A&&>(xval<A>());
  const_cast<A&&>(prval<A>());
}