The following program defines two structs whose only member is a flexible array. Such types are invalid and should be rejected. G++ diagnoses the one defined in the named struct but fails to diagnose the one in the unnamed struct. $ cat t.C && /build/gcc-trunk-svn/gcc/xgcc -B /build/gcc-trunk-svn/gcc -S -Wall -Wextra -Wpedantic t.C struct A { int a[]; }; typedef struct { int a[]; } B; t.C:2:9: error: flexible array member ‘A::a’ in an otherwise empty ‘struct A’ int a[]; ^ t.C:1:8: note: in the definition of ‘struct A’ struct A { ^
Same problem with an unnamed struct defined via an alias-declaration: using S = struct { int a[]; };
Fixed for GCC 9.3 and GCC 10+ by the patch which fixed PR 93753.