]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/22233 (ICE with wrong number of template parameters)
authorVolker Reichelt <reichelt@igpm.rwth-aachen.de>
Fri, 2 Sep 2005 11:20:21 +0000 (11:20 +0000)
committerVolker Reichelt <reichelt@gcc.gnu.org>
Fri, 2 Sep 2005 11:20:21 +0000 (11:20 +0000)
PR c++/22233
* pt.c (push_template_decl_real): Return error_mark_node if the
number of template parameters does not match previous definition.
* decl.c (start_function): Handle error_mark_node returned by
push_template_decl.

* g++.dg/template/param1.C: New test.

From-SVN: r103770

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/cp/pt.c
gcc/testsuite/ChangeLog

index 231698e8a674e197fc6a4525c1e8f5a3e47172ef..6e489b59743001d65255a848737a3e1098d3a008 100644 (file)
@@ -1,3 +1,11 @@
+2005-09-02  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
+
+       PR c++/22233
+       * pt.c (push_template_decl_real): Return error_mark_node if the
+       number of template parameters does not match previous definition.
+       * decl.c (start_function): Handle error_mark_node returned by
+       push_template_decl.
+
 2005-09-02  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
 
        Backport:
index 85aed90aee0612beb3ac611625dbc5702e04e47b..7381ae321228ace12163c372064cd8388691ba00 100644 (file)
@@ -10320,7 +10320,11 @@ start_function (tree declspecs, tree declarator, tree attrs, int flags)
      class scope, current_class_type will be NULL_TREE until set above
      by push_nested_class.)  */
   if (processing_template_decl)
-    decl1 = push_template_decl (decl1);
+    {
+      tree newdecl1 = push_template_decl (decl1);
+      if (newdecl1 != error_mark_node)
+       decl1 = newdecl1;
+    }
 
   /* We are now in the scope of the function being defined.  */
   current_function_decl = decl1;
index c3c9824853932cf4e1c66893eecb5bdbef2b9ea7..0db01ee65345bb1d348dde270b3af717e709c2a2 100644 (file)
@@ -2978,6 +2978,7 @@ push_template_decl_real (tree decl, int is_friend)
                  error ("got %d template parameters for `%#T'",
                            TREE_VEC_LENGTH (a), current);
                error ("  but %d required", TREE_VEC_LENGTH (t));
+               return error_mark_node;
              }
 
            /* Perhaps we should also check that the parms are used in the
index 674838ccc1026723b49baa2cd6004dfd232caf1e..c043043e9ec713b092c0f199830863d90557e49d 100644 (file)
@@ -1,3 +1,8 @@
+2005-09-02  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
+
+       PR c++/22233
+       * g++.dg/template/param1.C: New test.
+
 2005-09-02  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
 
        Backport: