https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59832
Matthijs van Duin <matthijsvanduin at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |matthijsvanduin at gmail dot com --- Comment #13 from Matthijs van Duin <matthijsvanduin at gmail dot com> --- I also just ran into this one with g++ 6.2.1. Here are some interesting cases: union Foo { union { int x; char y; } u; union { int x; char y; } v; int n; }; std::vector<Foo> foo = { {}, // ok { .u = {} }, // ok { .u = { .x = {} } }, // ok { .u = { .x = 0 } }, // ok { .u = { .y = {} } }, // ICE in reshape_init_class { .u = { .y = 0 } }, // ICE in reshape_init_class { .v = {} }, // ok { .v = { .x = {} } }, // ICE in reshape_init_class { .v = { .x = 0 } }, // ICE in reshape_init_class { .v = { .y = {} } }, // ICE in reshape_init_class { .v = { .y = 0 } }, // ICE in reshape_init_class { .n = {} }, // ok { .n = 0 }, // error: could not convert }; Some more observations: - Replacing the inner unions by structs results in the same errors (in addition to some warnings for missing initializers) - No errors occur if a C-style array is initialized instead of std::vector - It doesn't matter if the inner aggregates are anonymous or not. Similar things with an outer struct: struct Bar { union { int x; char y; } u; union { int x; char y; } v; }; std::vector<Bar> bar = { { .u = {}, .v = {} }, // ok { .u = {}, .v = { .x = 0 } }, // ok // { .u = {}, .v = { .y = 0 } }, // ICE in reshape_init_class { .u = { .x = 0 }, .v = {} }, // ok // { .u = { .y = 0 }, .v = {} }, // ICE in reshape_init_class // { .v = { .x = 0 }, .u = {} }, // ICE in reshape_init_class // { .v = {}, .u = { .x = 0 } }, // ICE in reshape_init_class // { .v = {}, .u = {} }, // sorry, unimplemented };