Merged trunk at revision 161680 into branch.
[official-gcc.git] / gcc / testsuite / g++.dg / cpp0x / nullptr04.C
blobbe581bcb6e372f5a15353e046f5d71ae490ca4c0
1 // { dg-do compile }
2 // { dg-options "-std=c++0x" }
4 // Test cast to int
6 __extension__ typedef __INTPTR_TYPE__ intptr_t;
8 const int n4 = static_cast<const int>(nullptr); // { dg-error "invalid static_cast " }
9 const short int n5 = reinterpret_cast<short int>(nullptr); // { dg-error "loses precision" }
10 const intptr_t n6 = reinterpret_cast<intptr_t>(nullptr);
11 const intptr_t n7 = (intptr_t)nullptr;
13 decltype(nullptr) mynull = 0;
14 const int n8 = static_cast<const int>(mynull); // { dg-error "invalid static_cast " }
15 const short int n9 = reinterpret_cast<short int>(mynull); // { dg-error "loses precision" }
16 const intptr_t n10 = reinterpret_cast<intptr_t>(mynull);
17 const intptr_t n11 = (intptr_t)mynull;