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: "daniel.kruegler at googlemail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 29 May 2012 21:16:57 +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 #14 from Daniel KrÃgler <daniel.kruegler at googlemail dot com> 2012-05-29 21:16:57 UTC ---
(In reply to comment #13)
> Am I interpreting correctly that double braces are /required/ for std::array
> init lists but only when the subtype has has a multivariable initializer too?
I must agree that the compiler behaviour does not look correct to me. Initially
I thought that the reason is due to the fact, that brace-elision does not apply
here, but then I noticed that this code does not compile either:
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. My impression is that the compiler incorrectly does
not see the brace-elision case here.
Here is an example that works (with an expected [-Wmissing-braces] warning):
struct string
{
string(const char*) { }
};
struct array_s
{
string data[1];
};
array_s b{ "smile" };
From this I see that gcc already implements
http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1270
so I must conclude that the compiler should also accept the original example.