The following invalid testcase causes an ICE since GCC 3.1: ======================================== template<int, int = 0> struct A; template<int> struct A { A(); }; A<0> a; ======================================== bug.cc:1: error: previous declaration 'template<int <anonymous>, int <anonymous> > struct A' bug.cc:3: error: used 2 template parameter(s) instead of 1 bug.cc: In constructor 'A<<anonymous>, <anonymous> >::A() [with int <anonymous> = 0]': bug.cc:8: instantiated from here bug.cc:5: internal compiler error: tree check: accessed elt 2 of tree_vec with 1 elts in tsubst, at cp/pt.c:7080 Please submit a full bug report, [etc.]
Confirmed.
3.4.0 did not ICE with checking disabled.
Another testcase which I ran into while reducing the bootstrap failure: template<typename _CharT, typename _Traits =int> class basic_istream; template<typename _CharT> struct basic_istream { ~basic_istream(){} }; class istrstream : public basic_istream<char> { ~istrstream() { } }
Subject: Bug number PR c++/26938 A patch for this bug has been added to the patch tracker. The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2006-09/msg01019.html
Subject: Bug 26938 Author: lmillward Date: Mon Sep 25 19:45:34 2006 New Revision: 117205 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=117205 Log: PR c++/27329 PR c++/26938 * cp-tree.h (redeclare_class_template): Adjust declaration to return bool instead of void. * pt.c (redeclare_class_template): Update definition. Return false on error. * decl.c (xref_tag): Return error_mark_node if redeclare_class_template returned false. * g++.dg/template/crash58.C: New test. * g++.dg/template/crash59.C: New test. * g++.dg/parse/crash28.C: Adjust error markers. * g++.dg/template/crash34.C: Likewise. * g++.dg/template/friend31.C: Likewise. * g++.dg/template/crash32.C: Likewise. Added: trunk/gcc/testsuite/g++.dg/template/crash58.C trunk/gcc/testsuite/g++.dg/template/crash59.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/cp-tree.h trunk/gcc/cp/decl.c trunk/gcc/cp/pt.c trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/g++.dg/parse/crash28.C trunk/gcc/testsuite/g++.dg/template/crash32.C trunk/gcc/testsuite/g++.dg/template/crash34.C trunk/gcc/testsuite/g++.dg/template/friend31.C
Fixed in 4.2.
Won't fix in GCC-4.0.x. Adjusting milestone.
Closing 4.1 branch.