OSDN Git Service

PR c++/27315
authorreichelt <reichelt@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 15 May 2006 09:07:17 +0000 (09:07 +0000)
committerreichelt <reichelt@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 15 May 2006 09:07:17 +0000 (09:07 +0000)
* pt.c (do_decl_instantiation): Return early on invalid decl.

* g++.dg/template/operator6.C: New test.
* g++.dg/template/incomplete3.C: New test.

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

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

index 739f0e1..f34ea88 100644 (file)
@@ -1,5 +1,8 @@
 2006-05-15  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
 
+       PR c++/27315
+       * pt.c (do_decl_instantiation): Return early on invalid decl.
+
        PR c++/27559
        * pt.c (push_template_decl_real): Return error_mark_node instead
        of broken decl.
index bcf2096..cf0e7cd 100644 (file)
@@ -11215,7 +11215,7 @@ do_decl_instantiation (tree decl, tree storage)
   tree result = NULL_TREE;
   int extern_p = 0;
 
-  if (!decl)
+  if (!decl || decl == error_mark_node)
     /* An error occurred, for which grokdeclarator has already issued
        an appropriate message.  */
     return;
index c7ef3ae..df08646 100644 (file)
@@ -1,5 +1,9 @@
 2006-05-15  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
 
+       PR c++/27315
+       * g++.dg/template/operator6.C: New test.
+       * g++.dg/template/incomplete3.C: New test.
+
        PR c++/27559
        * g++.dg/template/new4.C: New test.
 
diff --git a/gcc/testsuite/g++.dg/template/incomplete3.C b/gcc/testsuite/g++.dg/template/incomplete3.C
new file mode 100644 (file)
index 0000000..8a20bba
--- /dev/null
@@ -0,0 +1,5 @@
+// PR c++/27315
+// { dg-do compile }
+
+struct A;                  // { dg-error "forward declaration" }
+template void A::foo<0>(); // { dg-error "before|incomplete" }
diff --git a/gcc/testsuite/g++.dg/template/operator6.C b/gcc/testsuite/g++.dg/template/operator6.C
new file mode 100644 (file)
index 0000000..94a869b
--- /dev/null
@@ -0,0 +1,4 @@
+// PR c++/27315
+// { dg-do compile }
+
+template void operator+; // { dg-error "non-function" }