https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71912
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |ASSIGNED Last reconfirmed| |2016-07-18 Known to work| |5.4.0 Assignee|unassigned at gcc dot gnu.org |msebor at gcc dot gnu.org Summary|flexible array in union |[6/7 regression] flexible | |array in struct in union | |rejected Ever confirmed|0 |1 Known to fail| |6.1.0, 7.0 --- Comment #4 from Martin Sebor <msebor at gcc dot gnu.org> --- I confirm the code in the test case is meant to be accepted by G++ for compatibility with GCC but is rejected due to a bug in the find_flexarrays function in class.c. That said, it's not completely clear that the code is valid according to the C definition of a flexible array member: As a special case, the last element of a structure with more than one named member may have an incomplete array type; this is called a /flexible array member/. Although C doesn't define the term element, I think it means the last declared subobject of an object. In the test case, neither of the two flexible array members is the last element of struct xyyzy (the last element is the subobject u). Within the member u of struct xyyzy, the flexible array member f.s is not the last element of the structure xyyzy (b.t is the last element). Even though GCC with -Wpedantic silently accepts the equivalent definition of struct xyyzy, it issues a diagnostic for baz supporting the interpretation above: warning: invalid use of structure with flexible array member Since the struct definitions are equivalent, it seems that either they both should be diagnosed or neither should be.