c++: prvalue of array type [PR111286]
[official-gcc.git] / gcc / testsuite / g++.dg / cpp0x / nullptr04.C
blob7cb3559b3a341300826752e57e831a0f5e309fa7
1 // { dg-do compile { target c++11 } }
3 // Test cast to int
5 __extension__ typedef __INTPTR_TYPE__ intptr_t;
7 const int n4 = static_cast<const int>(nullptr); // { dg-error "16:invalid 'static_cast' " }
8 const short int n5 = reinterpret_cast<short int>(nullptr); // { dg-error "22:cast from .std::nullptr_t. to .short int. loses precision" "" { target { ! ptr_eq_short } } }
9 const intptr_t n6 = reinterpret_cast<intptr_t>(nullptr);
10 const intptr_t n7 = (intptr_t)nullptr;
12 decltype(nullptr) mynull = 0;
13 const int n8 = static_cast<const int>(mynull); // { dg-error "16:invalid 'static_cast' " }
14 const short int n9 = reinterpret_cast<short int>(mynull); // { dg-error "22:cast from .std::nullptr_t. to .short int. loses precision" "" { target { ! ptr_eq_short } } }
15 const intptr_t n10 = reinterpret_cast<intptr_t>(mynull);
16 const intptr_t n11 = (intptr_t)mynull;