Debian Codegraph @

gcc/testsuite/g++.dg/cpp0x/constexpr-union9.C

raw
1 // PR c++/118661
2 // { dg-do compile { target c++11 } }
3
4 using nullptr_t = decltype (nullptr);
5 union U { int i; nullptr_t n; };
6 constexpr U u = { 42 };
7 static_assert (u.n == nullptr, "");
8
9 #if __cplusplus >= 201402L
10 constexpr nullptr_t
11 foo ()
12 {
13 union U { int i; nullptr_t n; } u = { 42 };
14 return u.n;
15 }
16 #endif