https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68689
Bug ID: 68689 Summary: flexible array members in unions accepted in C++ Product: gcc Version: 6.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: --- GCC (in C mode) rejects flexible array members in unions. G++ (i.e., in C++ mode) accepts them. Since flexible array members are a G++ extension provided for compatibility with C, and specifically GCC, G++ should accept and reject the same constructs as GCC does. $ cat z.cpp && /build/gcc-trunk-svn/gcc/xg++ -B /build/gcc-trunk-svn/gcc -S -Wall -Wextra -Wpedantic -o/dev/null z.cpp union U { int n; int a[]; } u; z.cpp:3:11: warning: ISO C++ forbids zero-size array ‘a’ [-Wpedantic] int a[]; ^