1 // { dg-do compile { target c++14 } }
3 // this type is not value-initialisable
4 struct S { const int a; int b; };
6 union U1 { int k; S s; };
7 constexpr int test1() {
9 return u.s.b; // { dg-error "accessing .U1::s. member instead of initialized .U1::k. member" }
11 constexpr int x = test1();
13 union U2 { int :0; static int s; void foo(); int k; };
14 constexpr int test2() {
15 U2 u {}; // should skip zero-width bitfields, static members, and functions
18 static_assert(test2() == 0, "");