https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90951
Bug ID: 90951 Summary: error initializing a constexpr array of a struct with const member Product: gcc Version: 9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: msebor at gcc dot gnu.org Target Milestone: --- Here's another bug caused by my r270155. The valid code is accepted by Clang and GCC 8 but rejected by GCC 9.1.0 and 10.0. $ cat t.C && gcc -S -Wall t.C struct S { const char a[2]; }; constexpr struct S a[1] = { { "" } }; static_assert ('\0' == *a[0].a, "!"); t.C:5:30: error: use of deleted function ‘S::S()’ 5 | static_assert ('\0' == *a[0].a, "!"); | ^ t.C:1:8: note: ‘S::S()’ is implicitly deleted because the default definition would be ill-formed: 1 | struct S { const char a[2]; }; | ^ t.C:1:8: error: uninitialized const member in ‘struct S’ t.C:1:23: note: ‘const char S::a [2]’ should be initialized 1 | struct S { const char a[2]; }; | ^ t.C:5:37: error: use of deleted function ‘S::S()’ 5 | static_assert ('\0' == *a[0].a, "!"); | ^ t.C:5:21: error: non-constant condition for static assertion 5 | static_assert ('\0' == *a[0].a, "!"); | ~~~~~^~~~~~~~~~ t.C:5:21: error: use of deleted function ‘S::S()’