[Bug c++/53494] [4.7/4.8 Regression] ICE with invalid initializer list

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue May 29 23:36:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53494

--- Comment #16 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-05-29 23:34:14 UTC ---
(In reply to comment #14)
> struct pair
> {
>   pair(const char*, int) { }
> };
> 
> struct array_p
> {
>   pair data[1];
> };
> 
> array_p a  = { { "smile", 1 } };
> 
> Here we have definitively brace elision in action, but I get the same error as
> from Jonathan's example.


"If the initializer-list begins with a left brace,"

which it does

"then the succeeding comma-separated list of initializer-clauses initializes
the members of a subaggregate;"

I read that to mean that { "smile", 1 } initializes the pair[1]

"it is erroneous for there to be more initializer-clauses than members."

There is only one member of pair[1] but two initializer-clauses.

So I think the error is required, but Daniel is usually right about such things
so I'm not certain :)



More information about the Gcc-bugs mailing list