aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2008-11-25 22:51:40 -0500
committerJason Merrill <jason@gcc.gnu.org>2008-11-25 22:51:40 -0500
commit1dbc1ae77ad4b55903d723266e4ecb18a4ff851a (patch)
tree870f97aa9f774f2c732f8f24102c1890864d390f /gcc
parent9feafad0c9cbe1bf62741e1c0426053636ed9711 (diff)
downloadgcc-1dbc1ae77ad4b55903d723266e4ecb18a4ff851a.zip
gcc-1dbc1ae77ad4b55903d723266e4ecb18a4ff851a.tar.gz
gcc-1dbc1ae77ad4b55903d723266e4ecb18a4ff851a.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/decl2.c11
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/template/nontype18.C8
4 files changed, 27 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 9880815..e128fe1 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index a0ae6e4..da9201e 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 a508f75..08ee43c 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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.
diff --git a/gcc/testsuite/g++.dg/template/nontype18.C b/gcc/testsuite/g++.dg/template/nontype18.C
new file mode 100644
index 0000000..cbe0a1b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/nontype18.C
@@ -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" }