From: Jason Merrill Date: Wed, 26 Nov 2008 03:51:40 +0000 (-0500) Subject: re PR c++/28743 (ICE with invalid specialization) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1dbc1ae77ad4b55903d723266e4ecb18a4ff851a;p=gcc.git re PR c++/28743 (ICE with invalid specialization) PR c++/28743 * decl2.c (check_classfn): Error rather than abort on parameter list mismatch. From-SVN: r142212 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 98808152cb8..e128fe1f382 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2008-11-25 Jason Merrill + + PR c++/28743 + * decl2.c (check_classfn): Error rather than abort on parameter + list mismatch. + 2008-11-20 Jason Merrill PR c++/28513 diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index a0ae6e4f7be..da9201e8890 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -572,9 +572,14 @@ check_classfn (tree ctype, tree function, tree template_parms) either were not passed, or they are the same of DECL_TEMPLATE_PARMS. */ if (TREE_CODE (function) == TEMPLATE_DECL) { - gcc_assert (!template_parms - || comp_template_parms (template_parms, - DECL_TEMPLATE_PARMS (function))); + if (template_parms + && !comp_template_parms (template_parms, + DECL_TEMPLATE_PARMS (function))) + { + error ("template parameter lists provided don't match the " + "template parameters of %qD", function); + return error_mark_node; + } template_parms = DECL_TEMPLATE_PARMS (function); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a508f752d13..08ee43c77e3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-11-25 Jason Merrill + + PR c++/28743 + * g++.dg/template/nontype18.C: New test. + 2008-11-25 Maxim Kuvyrkov * gcc.c-torture/compile/20080929-1.c: New. diff --git a/gcc/testsuite/g++.dg/template/nontype18.C b/gcc/testsuite/g++.dg/template/nontype18.C new file mode 100644 index 00000000000..cbe0a1b5a0d --- /dev/null +++ b/gcc/testsuite/g++.dg/template/nontype18.C @@ -0,0 +1,8 @@ +// PR c++/28743 + +template struct A +{ + template void foo(); +}; + +template template void A<0>::foo() {} // { dg-error "template parameter" }