http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49355
Summary: new T({""}) crashes G++ when struct T { std::string
foobar };
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: [email protected]
ReportedBy: [email protected]
Created attachment 24482
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24482
Minimal test case producing the (un)desired behavior, and temporary files.
The following code:
#include <string>
struct T {
std::string foobar;
};
T* x = new T({""});
Produces the following behavior:
peter@magma:~/tmp/a$ g++ --version
g++ (Ubuntu 4.4.1-4ubuntu9) 4.4.1
Copyright (C) 2009 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
peter@magma:~/tmp/a$ g++ -Wall -Wextra test_case.cpp
test_case.cpp:9: warning: extended initializer lists only available with
-std=c++0x or -std=gnu++0x
test_case.cpp:9: warning: extended initializer lists only available with
-std=c++0x or -std=gnu++0x
test_case.cpp: In function ‘void __static_initialization_and_destruction_0(int,
int)’:
test_case.cpp:9: internal compiler error: in lower_stmt, at gimple-low.c:408
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.4/README.Bugs> for instructions.
I listed the affected version as 4.7.0 because when I went on IRC, I was
informed by a user there that 4.7.0 20110524 (experimental) [trunk revision
174141] is still affected.
System information:
peter@magma:~$ uname -a
Linux magma 2.6.31-23-generic #75-Ubuntu SMP Fri Mar 18 18:16:06 UTC 2011
x86_64 GNU/Linux
peter@magma:~$ cat /etc/issue
Ubuntu 9.10 \n \l
Attached is the code and the temps.