This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/53494] [4.7/4.8 Regression] ICE with invalid initializer list
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 29 May 2012 23:34:14 +0000
- Subject: [Bug c++/53494] [4.7/4.8 Regression] ICE with invalid initializer list
- Auto-submitted: auto-generated
- References: <bug-53494-4@http.gcc.gnu.org/bugzilla/>
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 :)