The following invalid code snippet triggers an ICE since GCC 3.3: ================================================= template<int> struct A { static int a[1]; }; template<int N> int A<N>::a[1] = { X: 0 }; void foo() { A<0>::a; } ================================================= bug.cc: In instantiation of 'int A<0>::a [1]': bug.cc:10: instantiated from here bug.cc:6: error: 'X' was not declared in this scope bug.cc:6: internal compiler error: in reshape_init_array_1, at cp/decl.c:4350 Please submit a full bug report, [etc.]
Confirmed.
won't fix in GCC-4.0.x. Adjusting milestone.
The bug disappeared on the 4.1 branch (already in GCC 4.1.2). It is still present on the 4.2 branch and mainline.
When fixing this bug we also want to make sure we do not reject this valid variant: template<int> struct A { struct S { int X; }; static S a; }; template<int N> typename A<N>::S A<N>::a = { X : 1 }; void foo() { A<0>::a; }
Change target milestone to 4.2.3, as 4.2.2 has been released.
4.2.3 is being released now, changing milestones of open bugs to 4.2.4.
4.2.4 is being released, changing milestones to 4.2.5.
PR37736 opened for the reject valid case (it's a different bug). Patch for the ICE submitted here: http://gcc.gnu.org/ml/gcc-patches/2008-10/msg00134.html
Approved: http://gcc.gnu.org/ml/gcc-patches/2009-03/msg01080.html
Subject: Bug 29727 Author: hjl Date: Fri Mar 27 13:11:29 2009 New Revision: 145104 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=145104 Log: gcc/cp/ 2009-03-27 Simon Martin <simartin@users.sourceforge.net> PR c++/29727 * decl.c (check_array_designated_initializer): Handle error_mark_node. gcc/testsuite/ 2009-03-27 Simon Martin <simartin@users.sourceforge.net> PR c++/29727 * g++.dg/init/error2.C: New test. Added: trunk/gcc/testsuite/g++.dg/init/error2.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/decl.c trunk/gcc/testsuite/ChangeLog
Closing 4.2 branch.
WONTFIX for 4.3.