https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71742
Bug ID: 71742 Summary: Wrong formulation of "error: flexible array member in otherwise empty struct" Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: ch3root at openwall dot com Target Milestone: --- Source code: ---------------------------------------------------------------------- int main() { struct s { int :1; int a[]; }; } ---------------------------------------------------------------------- Results: ---------------------------------------------------------------------- $ gcc -std=c11 -pedantic -Wall -Wextra -O3 test.c && ./a.out test.c: In function ‘main’: test.c:5:9: error: flexible array member in otherwise empty struct int a[]; ^ ---------------------------------------------------------------------- gcc version: gcc (GCC) 7.0.0 20160627 (experimental) gcc is right in detecting an error in this testcase but the message is wrong because the struct is not otherwise empty. The problem is absence of named members. The relevant rule: C11, 6.7.2.1p18: "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."