Fortran: Fix PR 47485.
[gcc.git] / gcc / testsuite / g++.dg / cpp0x / constexpr-reinterpret2.C
blob1bc2a8f301226f4ce993d90280b719f6d1cee741
1 // { dg-do compile { target c++11 } }
3 struct S { void *p; };
4 struct T { S s; };
5 constexpr S s = { nullptr };
6 constexpr T t = { { nullptr } };
8 constexpr void *
9 foo ()
11   return ((void **) &t)[0];     // { dg-error "reinterpret_cast" }
14 constexpr void *
15 bar ()
17   return ((void **) &s)[0];     // { dg-error "reinterpret_cast" }
20 constexpr auto x = foo ();
21 constexpr auto y = bar ();