On Fri, 19 Apr 2024, Qing Zhao wrote: > gcc/testsuite/ChangeLog: > > * gcc.dg/flex-array-in-union-1.c: New test. > * gcc.dg/flex-array-in-union-2.c: New test.
There should also be a -pedantic-errors test that these constructs get errors with -pedantic-errors. The tests mix two cases: flexible arrays in unions, and flexible arrays on their own in structures. That means the test names are misleading; either they should be renamed, or the struct tests should be split out. Note that "no named members" also includes the case where there are unnamed bit-fields together with a flexible array member, so that should be tested as well. Since this patch series involves changes for both C and C++, it would be best for the tests to be c-c++-common tests. But if that's problematic for some reason - if there's still too much difference in behavior between C and C++ - then there should at least be tests for C++ that are as similar as possible to the tests for C. -- Joseph S. Myers josmy...@redhat.com