re PR c++/23191 (ICE on invalid throw in template)
authorVolker Reichelt <reichelt@igpm.rwth-aachen.de>
Sat, 6 Aug 2005 22:38:44 +0000 (22:38 +0000)
committerVolker Reichelt <reichelt@gcc.gnu.org>
Sat, 6 Aug 2005 22:38:44 +0000 (22:38 +0000)
PR c++/23191
* pt.c (tsubst) <case METHOD_TYPE>: Check for error_mark_node
before calling build_exception_variant.

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

From-SVN: r102819

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

index 5593ef6f383184137eae2343e301b6abad5fd6e9..6220be681e615eb45ff181ea397ec95d3527eead 100644 (file)
@@ -1,3 +1,9 @@
+2005-08-06  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
+
+       PR c++/23191
+       * pt.c (tsubst) <case METHOD_TYPE>: Check for error_mark_node
+       before calling build_exception_variant.
+
 2005-08-06  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
 
        PR c++/19498
index bd95372478fab97f8721e6e50db28377d9f5c282..cabda6cbf9e952f94e2bd3c124574275e20d10b2 100644 (file)
@@ -7336,6 +7336,8 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl)
        /* Substitute the exception specification.  */
        specs = tsubst_exception_specification (t, args, complain,
                                                in_decl);
+       if (specs == error_mark_node)
+         return error_mark_node;
        if (specs)
          fntype = build_exception_variant (fntype, specs);
        return fntype;
index 690dbf41c2024ec64156877ef1958f5833626de9..5ed686f8dd88617d9ce9c61b06613427296ae2df 100644 (file)
@@ -1,3 +1,8 @@
+2005-08-06  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
+
+       PR c++/23191
+       * g++.dg/template/eh2.C: New test.
+
 2005-08-06  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
 
        PR c++/19498
diff --git a/gcc/testsuite/g++.dg/template/eh2.C b/gcc/testsuite/g++.dg/template/eh2.C
new file mode 100644 (file)
index 0000000..8ec767d
--- /dev/null
@@ -0,0 +1,10 @@
+// PR c++/23191
+// Origin: Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
+// { dg-do compile }
+
+template<typename T> struct A
+{
+    void foo() throw(typename T::X);  // { dg-error "not a class" }
+};
+
+A<void> a;                            // { dg-error "instantiated" }