https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94558
Bug ID: 94558 Summary: Designated initializer inside _Generic is misinterpreted Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: elronnd at elronnd dot net Target Milestone: --- POC: typedef struct{int _;} A; typedef struct{int _;} B; typedef union { A a; B b; } O; #define NO(o) _Generic((o), \ A: ((O){.a=o}), \ B: ((O){.b=o})) int main() { A a; O o = NO(a); } Generates the error message: incompatible types when initializing type ‘int’ using type ‘A’ {aka ‘struct <anonymous>’} Because it's trying to initialize the '_' field in 'A' with 'a', instead of the 'a' field in 'O'.