OSDN Git Service

PR c++/22233
authorreichelt <reichelt@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 22 Aug 2005 09:48:26 +0000 (09:48 +0000)
committerreichelt <reichelt@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 22 Aug 2005 09:48:26 +0000 (09:48 +0000)
* pt.c (push_template_decl_real): Return error_mark_node if the
number of template parameters does not match previous definition.

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

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@103339 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/template/param1.C [new file with mode: 0644]

index 765ce9c..0ad264f 100644 (file)
@@ -1,5 +1,11 @@
 2005-08-22  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.
+
+2005-08-22  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
+
        PR c++/23089
        * decl.c (require_complete_types_for_parms): Mark incomplete types
        as invalid.
index 73e2a25..f217198 100644 (file)
@@ -3109,6 +3109,7 @@ push_template_decl_real (tree decl, int is_friend)
                  error ("got %d template parameters for %q#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 5d6a682..b85a569 100644 (file)
@@ -1,5 +1,10 @@
 2005-08-22  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
 
+       PR c++/22233
+       * g++.dg/template/param1.C: New test.
+
+2005-08-22  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
+
        PR c++/23089
        * g++.dg/other/incomplete1.C: New test.
 
diff --git a/gcc/testsuite/g++.dg/template/param1.C b/gcc/testsuite/g++.dg/template/param1.C
new file mode 100644 (file)
index 0000000..ad7fc8c
--- /dev/null
@@ -0,0 +1,12 @@
+// PR c++/22233
+// Origin: Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
+// { dg-do compile }
+
+template<int> struct A
+{
+  A();
+};
+
+template<int N, char> A<N>::A() {}  // { dg-error "got 2|but 1 required" }
+
+A<0> a;