https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102538

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ppalka at gcc dot gnu.org

--- Comment #4 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Analogous constexpr testcase:

struct X { union { char r8[8]; int r32[2]; }; };
struct Y { X v; };
constexpr Y x = { { .r32 = { 5, 6 } } };
static_assert(x.v.r32[0] == 5 && x.v.r32[1] == 6);

The error is perhaps insightful:

<stdin>:4:31: error: non-constant condition for static assertion
<stdin>:4:31: error: accessing ‘X::<unnamed union>::r32’ member instead of
initialized ‘X::<unnamed union>::r8’ member in constant expression

Reply via email to