The following invalid code snippet triggers an ICE since GCC 4.1.0: =============================== template<int> struct A { static const int i; }; template<int N> struct B { char c[A<N>::i], d; }; B<0> b; =============================== bug.cc: In instantiation of 'B<0>': bug.cc:11: instantiated from here bug.cc:7: internal compiler error: tree check: expected integer_cst, have nop_expr in walk_subobject_offsets, at cp/class.c:3126 Please submit a full bug report, [etc.]
A regression hunt on powerpc-linux identified the following patch: http://gcc.gnu.org/viewcvs?view=rev&rev=106566 r106566 | mmitchel | 2005-11-06 19:41:18 +0000 (Sun, 06 Nov 2005)
Confirmed by Janis.
Subject: Bug 28595 Author: mmitchel Date: Sat Aug 26 16:23:33 2006 New Revision: 116468 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=116468 Log: PR c++/28588 * class.c (resolve_address_of_overloaded_function): Add access_path parameter. Perform access checks. (instantiate_type): Adjust call to resolve_address_of_overloaded_function. Remove unnecessary code. * tree.c (is_overloaded_fn): Document. Return 2 when there are acutally multiple functions. (really_overloaded_fn): Use is_overloaded_fn. * mangle.c (write_expression): Handle BASELINKs. * cp-tree.h (really_overloaded_fn): Return bool. (baselink_for_fns): Declare. * search.c (lookup_member): Check access for single static functions here. * pt.c (convert_nontype_argument_function): Handle BASELINKs. (tsubst_copy_and_build): Generate BASELINKs for template-ids. * semantics.c (finish_call_expr): Use baselink_for_fns. (baselink_for_fns): New function. (finish_id_expression): Use it. * parser.c (cp_parser_template_argument): Don't strip BASELINKs. PR c++/28595 * pt.c (tsubst): Issue errors about attempts to create VLAs at template-instantiation time. PR c++/28588 * g++.dg/inherit/access6.C: New test. * g++.dg/inherit/access7.C: Likewise. PR c++/28595 * g++.dg/template/array15.C: New test. * g++.dg/template/crash2.C: Tweak error markers. Added: trunk/gcc/testsuite/g++.dg/inherit/access6.C trunk/gcc/testsuite/g++.dg/inherit/access7.C trunk/gcc/testsuite/g++.dg/template/array15.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/class.c trunk/gcc/cp/cp-tree.h trunk/gcc/cp/mangle.c trunk/gcc/cp/parser.c trunk/gcc/cp/pt.c trunk/gcc/cp/search.c trunk/gcc/cp/semantics.c trunk/gcc/cp/tree.c trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/g++.dg/template/crash2.C
Fixed in 4.2.0.
Subject: Bug 28595 Author: mmitchel Date: Sat Aug 26 17:13:52 2006 New Revision: 116471 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=116471 Log: PR c++/28595 * pt.c (tsubst): Issue errors about attempts to create VLAs at template-instantiation time. PR c++/28595 * g++.dg/template/array15.C: New test. * g++.dg/template/crash2.C: Tweak error markers. Added: branches/gcc-4_1-branch/gcc/testsuite/g++.dg/template/array15.C Modified: branches/gcc-4_1-branch/gcc/cp/ChangeLog branches/gcc-4_1-branch/gcc/cp/pt.c branches/gcc-4_1-branch/gcc/testsuite/ChangeLog branches/gcc-4_1-branch/gcc/testsuite/g++.dg/template/crash2.C
Fixed in 4.1.2.