https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87097
Bug ID: 87097 Summary: value-initialization of an array of more than 1 element not treated as a constant initializer Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: richard-gccbugzilla at metafoo dot co.uk Target Milestone: --- Live testcase: https://godbolt.org/z/1JYWJS For posterity: struct A { constexpr A() : data() {} struct X { int n; }; X data[2]; }; static_assert((A(), true)); static_assert(A().data[0].n == 0); static_assert(A().data[1].n == 0); constexpr A x; GCC rejects this valid code with: <source>:9:29: error: non-constant condition for static assertion 9 | static_assert(A().data[1].n == 0); | ~~~~~~~~~~~~~~^~~~ <source>:9:29: error: accessing uninitialized member 'A::X::n' <source>:10:13: error: 'A{A::X [2]{A::X{0}, A::X()}}' is not a constant expression 10 | constexpr A x; | Looks like GCC fails to evaluate the initializer of the second and subsequent elements of a value-initialized array during constant evaluation.