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
This commit is contained in:
Jason Merrill 2008-11-25 22:51:40 -05:00 committed by Jason Merrill
parent 9feafad0c9
commit 1dbc1ae77a
4 changed files with 27 additions and 3 deletions

View File

@ -1,3 +1,9 @@
2008-11-25 Jason Merrill <jason@redhat.com>
PR c++/28743
* decl2.c (check_classfn): Error rather than abort on parameter
list mismatch.
2008-11-20 Jason Merrill <jason@redhat.com>
PR c++/28513

View File

@ -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);
}

View File

@ -1,3 +1,8 @@
2008-11-25 Jason Merrill <jason@redhat.com>
PR c++/28743
* g++.dg/template/nontype18.C: New test.
2008-11-25 Maxim Kuvyrkov <maxim@codesourcery.com>
* gcc.c-torture/compile/20080929-1.c: New.

View File

@ -0,0 +1,8 @@
// PR c++/28743
template<int I> struct A
{
template<typename T> void foo();
};
template<int I> template<typename T> void A<0>::foo() {} // { dg-error "template parameter" }