https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119001
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- union U { int i; char a[]; }; union U u[2] = {{.a = "12345"}}; is accepted but does the wrong thing (the u[0] content overlaps into the u[1] one). union U { int i; char a[]; }; union U u[2] = {{.a = "12345"},{.i = 3 }}; ICEs in a different spot. Note, struct U { int i; char a[]; }; struct U u[2] = {{.a = "123"}}; is rejected with pr119001-2.c:5:24: error: initialization of flexible array member in a nested context 5 | struct U u[2] = {{.a = "123"}}; | ^~~~~ pr119001-2.c:5:24: note: (near initialization for ‘u[0]’) so I think we should emit the same error for the union case as well.