]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/g++.dg/cpp0x/constexpr-reinterpret2.C
aarch64: Further renaming of generic code
[thirdparty/gcc.git] / gcc / testsuite / g++.dg / cpp0x / constexpr-reinterpret2.C
1 // { dg-do compile { target c++11 } }
2
3 struct S { void *p; };
4 struct T { S s; };
5 constexpr S s = { nullptr };
6 constexpr T t = { { nullptr } };
7
8 constexpr void *
9 foo ()
10 {
11 return ((void **) &t)[0]; // { dg-error "reinterpret_cast" }
12 }
13
14 constexpr void *
15 bar ()
16 {
17 return ((void **) &s)[0]; // { dg-error "reinterpret_cast" }
18 }
19
20 constexpr auto x = foo ();
21 constexpr auto y = bar ();