re PR c++/28250 (ICE with invalid catch)

PR c++/28250
	* pt.c (tsubst_expr): Only apply DECL_TEMPLATE_INSTANTIATED to
	valid decls.  Cleanup.

	* g++.dg/eh/catch3.C: New test.

From-SVN: r115643
This commit is contained in:
Volker Reichelt 2006-07-21 09:59:57 +00:00 committed by Volker Reichelt
parent e488a090e6
commit 3a2419a7ec
4 changed files with 22 additions and 7 deletions

View file

@ -1,5 +1,9 @@
2006-07-21 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
PR c++/28250
* pt.c (tsubst_expr): Only apply DECL_TEMPLATE_INSTANTIATED to
valid decls. Cleanup.
PR c++/28363
* semantics.c (check_template_template_default_arg): Simplify
error handling.

View file

@ -8491,20 +8491,18 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl)
case HANDLER:
{
tree decl;
tree decl = HANDLER_PARMS (t);
stmt = begin_handler ();
if (HANDLER_PARMS (t))
if (decl)
{
decl = HANDLER_PARMS (t);
decl = tsubst (decl, args, complain, in_decl);
/* Prevent instantiate_decl from trying to instantiate
this variable. We've already done all that needs to be
done. */
DECL_TEMPLATE_INSTANTIATED (decl) = 1;
if (decl != error_mark_node)
DECL_TEMPLATE_INSTANTIATED (decl) = 1;
}
else
decl = NULL_TREE;
stmt = begin_handler ();
finish_handler_parms (decl, stmt);
tsubst_expr (HANDLER_BODY (t), args, complain, in_decl);
finish_handler (stmt);

View file

@ -1,5 +1,8 @@
2006-07-21 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
PR c++/28250
* g++.dg/eh/catch3.C: New test.
PR c++/28363
* g++.dg/template/defarg10.C: New test.

View file

@ -0,0 +1,10 @@
// PR c++/28250
// { dg-do compile }
template<int> void foo()
{
try {}
catch () {} // { dg-error "type-specifier" }
}
template void foo<0>();