Compiling: typedef struct t { char *d; union { int aa; float ab; } a; } T;
int f() { T s = {"one", 1}; return s.a.aa; } with -Wall --std=c99 yields: structinit.c: In function 'f': structinit.c:10: warning: missing braces around initializer structinit.c:10: warning: (near initialization for 's.a') However, my understanding of C99[/TC3] section 6.7.8, point 17 and in particular footnote 129 suggests that this initialisation is quite valid. (Tested here against gcc version 4.2.1 20070719 [FreeBSD]; 3.2.3 on redhat produced the same warning.) -- Summary: Initialising a union member of a struct without braces Product: gcc Version: 4.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: stl at koffein dot net http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37476