http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49669
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jason at gcc dot gnu.org --- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-07-07 16:39:56 UTC --- (In reply to comment #4) > Say, since you're here, if I change the definition of x from "Foo[2]" to > "std::array<Foo,2>", should I be allowed to initialize it with > > Goo::Goo() : x{{Foo(4), Foo(5)}} { } I think that should be valid > At the moment, _only_ the following seems to work: > > Goo::Goo() : x({{Foo(4), Foo(5)}}) { } Hmm, that creates a temporary array<Foo,2> and uses that to initialize x, I don't think that should be necessary. > In particular, initialization of "Foo[2]" and "std::array<Foo,2>" is anything > but "uniform" :-) It will never be completely uniform, because one is an array and one is an aggregate containing an array, but I think any of these should be valid: struct Foo { explicit Foo(int) { } }; struct TwoFoo { Foo elems[2]; }; TwoFoo x{ Foo(1), Foo(1) }; TwoFoo y{ { Foo(1), Foo(1) } }; TwoFoo z( { Foo(1), Foo(1) } ); // ? struct Goo { Foo a[2]; TwoFoo x, y, z; Goo() : a{ Foo(1), Foo(2) } , x{ Foo(1), Foo(2) } , y{ { Foo(1), Foo(2) } } , z( { Foo(1), Foo(2) } ) // ? { } }; Jason, when you get around to looking at this ICE, could you comment on the initialization question above? Thanks!