This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/55240] New: [c++0x] ICE on non-static data member initialization using 'auto' variable from containing function
- From: "bisqwit at iki dot fi" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 08 Nov 2012 14:34:09 +0000
- Subject: [Bug c++/55240] New: [c++0x] ICE on non-static data member initialization using 'auto' variable from containing function
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55240
Bug #: 55240
Summary: [c++0x] ICE on non-static data member initialization
using 'auto' variable from containing function
Classification: Unclassified
Product: gcc
Version: 4.7.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: bisqwit@iki.fi
This code causes an ICE in GCC 4.7.1 and 4.7.2:
int main()
{
int q = 1;
struct test { int x = q; } instance;
}
tmpq.cc: In constructor 'constexpr main()::test::test()':
tmpq.cc:4:12: internal compiler error: in expand_expr_real_1, at expr.c:9122
It is notable that if the code is written like this, the error message changes.
int main()
{
int q = 1;
struct test { int x; test():x(q){} } instance;
}
tmpq.cc:5:35: error: use of 'auto' variable from containing function
tmpq.cc:3:9: error: 'int q' declared here