Debian Codegraph @

gcc/testsuite/g++.dg/cpp1y/constexpr-union6.C

raw
1 // { dg-do compile { target c++14 } }
2
3 union U {
4 int a;
5 float b;
6 };
7
8 constexpr bool foo() {
9 U u {};
10 u.b = 1.0f; // { dg-error "change of the active member" "" { target c++17_down } }
11 return u.b == 1.0f;
12 }
13 constexpr bool x = foo();