https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110245
Bug ID: 110245 Summary: constant evaluation fails with uninitialized union and default constructor Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: danakj at orodu dot net Target Milestone: --- ``` struct Store { constexpr Store() {} union { int i; }; bool b = false; }; struct C { constexpr C() = default; Store s; }; int main() { constexpr auto c = C(); // } ``` This should compile but does not, GCC complains that it refers to an incompletely initialized variable. Union members are not required to be active. https://godbolt.org/z/G9vcosTG1 Reproduced on GCC trunk and GCC 11.