re PR c++/19498 (ICE on invalid reference in template parameter)
authorVolker Reichelt <reichelt@igpm.rwth-aachen.de>
Sat, 6 Aug 2005 22:22:47 +0000 (22:22 +0000)
committerVolker Reichelt <reichelt@gcc.gnu.org>
Sat, 6 Aug 2005 22:22:47 +0000 (22:22 +0000)
PR c++/19498
* pt.c (tsubst_decl) <case TEMPLATE_DECL>: Return ERROR_MARK_NODE
if substitution of template args did not succeed.

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

From-SVN: r102818

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

index f935d4e89dc4e9f3777c0ebd83dd72a135cee3fe..5593ef6f383184137eae2343e301b6abad5fd6e9 100644 (file)
@@ -1,3 +1,9 @@
+2005-08-06  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
+
+       PR c++/19498
+       * pt.c (tsubst_decl) <case TEMPLATE_DECL>: Return ERROR_MARK_NODE
+       if substitution of template args did not succeed.
+
 2005-08-06  Michael Matz  <matz@suse.de>
 
        * method.c (use_thunk): Call init_insn_lengths.
index cc3c03e7fe93f5ffdd7343e9087b4a74bc70eb9c..bd95372478fab97f8721e6e50db28377d9f5c282 100644 (file)
@@ -6224,6 +6224,8 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain)
          : DECL_TI_ARGS (DECL_TEMPLATE_RESULT (t));
        full_args = tsubst_template_args (tmpl_args, args,
                                          complain, in_decl);
+       if (full_args == error_mark_node)
+         return error_mark_node;
 
        /* tsubst_template_args doesn't copy the vector if
           nothing changed.  But, *something* should have
index 6e27aec9c24b278d4f4bd29b6e28729eb382194a..690dbf41c2024ec64156877ef1958f5833626de9 100644 (file)
@@ -1,3 +1,8 @@
+2005-08-06  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
+
+       PR c++/19498
+       * g++.dg/template/instantiate7.C: New test.
+
 2005-08-06  Joseph S. Myers  <joseph@codesourcery.com>
 
        PR c/23113
diff --git a/gcc/testsuite/g++.dg/template/instantiate7.C b/gcc/testsuite/g++.dg/template/instantiate7.C
new file mode 100644 (file)
index 0000000..14a1a33
--- /dev/null
@@ -0,0 +1,10 @@
+// PR c++/19498
+// Origin: Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
+// { dg-do compile }
+
+template<typename T> struct A
+{
+    template<T&> struct B;  // { dg-error "reference to void" }
+};
+
+A<void> a;                  // { dg-error "instantiated" }