From 9f6206d9df6963318e5bf2ea6ddc5c747f46ff37 Mon Sep 17 00:00:00 2001 From: Volker Reichelt Date: Sat, 6 Aug 2005 22:38:44 +0000 Subject: [PATCH] re PR c++/23191 (ICE on invalid throw in template) PR c++/23191 * pt.c (tsubst) : Check for error_mark_node before calling build_exception_variant. * g++.dg/template/eh2.C: New test. From-SVN: r102819 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/pt.c | 2 ++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/template/eh2.C | 10 ++++++++++ 4 files changed, 23 insertions(+) create mode 100644 gcc/testsuite/g++.dg/template/eh2.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 5593ef6f383..6220be681e6 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2005-08-06 Volker Reichelt + + PR c++/23191 + * pt.c (tsubst) : Check for error_mark_node + before calling build_exception_variant. + 2005-08-06 Volker Reichelt PR c++/19498 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index bd95372478f..cabda6cbf9e 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -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; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 690dbf41c20..5ed686f8dd8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2005-08-06 Volker Reichelt + + PR c++/23191 + * g++.dg/template/eh2.C: New test. + 2005-08-06 Volker Reichelt 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 index 00000000000..8ec767d3933 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/eh2.C @@ -0,0 +1,10 @@ +// PR c++/23191 +// Origin: Volker Reichelt +// { dg-do compile } + +template struct A +{ + void foo() throw(typename T::X); // { dg-error "not a class" } +}; + +A a; // { dg-error "instantiated" }