re PR c++/27315 (ICE with ill-placed expression)
authorVolker Reichelt <reichelt@igpm.rwth-aachen.de>
Mon, 15 May 2006 09:07:17 +0000 (09:07 +0000)
committerVolker Reichelt <reichelt@gcc.gnu.org>
Mon, 15 May 2006 09:07:17 +0000 (09:07 +0000)
PR c++/27315
* pt.c (do_decl_instantiation): Return early on invalid decl.

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

From-SVN: r113778

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 739f0e145e17e57a4fd9f165866f4923b6830f24..f34ea88fb99541127f0a8be83b6f9f6cad80ca2c 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 bcf2096576488f639338e842bd8d6fb6bb320f80..cf0e7cd4f9a01ebfd0806c7959862e54d16904c4 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 c7ef3aeae72ec726a27a0d0c5a6fefcacc11bb38..df0864627f3f18797f6cf648632f47d48bd0afe0 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" }