https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70932
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |ASSIGNED Last reconfirmed| |2016-05-04 Known to work| |4.9.3, 5.3.0 Assignee|unassigned at gcc dot gnu.org |msebor at gcc dot gnu.org Ever confirmed|0 |1 Known to fail| |6.1.0 --- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> --- The problem was introduced r233126 as a result of switching the internal flexible array representation to use a null type domain. Prior to 6.1, GCC treated flexible array members the same as arrays of zero elements. I'll have to think about what the right solution is: reject flexible array members with non-trivial destructors with a better error (like clang does) or allow them with a warning. My concern with allowing them is that while G++ 6.1 allows them to be initialized (5.x rejects the initialization which seems like a bug), it won't be able to invoke their destructor in code like this: struct A { int i; ~A() { __builtin_printf ("%s\n", __PRETTY_FUNCTION__); } }; struct S { int i; A a[]; }; int main () { S s = { 3, { 1, 2, 3 } }; }