re PR c++/28250 (ICE with invalid catch)
PR c++/28250 * name-lookup.c (pushdecl_maybe_friend): Return early on error_mark_node. * except.c (expand_start_catch_block): Use error_mark_node instead of NULL_TREE for invalid decls. * parser.c (cp_parser_exception_declaration): Return error_mark_node on invalid catch parameter. Simplify. * g++.dg/eh/catch1.C: New test. * g++.dg/eh/catch2.C: New test. From-SVN: r115516
This commit is contained in:
parent
23be7a6691
commit
2a50edcd0f
|
@ -1,3 +1,13 @@
|
|||
2006-07-17 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
|
||||
|
||||
PR c++/28250
|
||||
* name-lookup.c (pushdecl_maybe_friend): Return early on
|
||||
error_mark_node.
|
||||
* except.c (expand_start_catch_block): Use error_mark_node instead
|
||||
of NULL_TREE for invalid decls.
|
||||
* parser.c (cp_parser_exception_declaration): Return error_mark_node
|
||||
on invalid catch parameter. Simplify.
|
||||
|
||||
2006-07-16 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR c++/28370
|
||||
|
|
|
@ -412,7 +412,7 @@ expand_start_catch_block (tree decl)
|
|||
|
||||
/* Make sure this declaration is reasonable. */
|
||||
if (decl && !complete_ptr_ref_or_void_ptr_p (TREE_TYPE (decl), NULL_TREE))
|
||||
decl = NULL_TREE;
|
||||
decl = error_mark_node;
|
||||
|
||||
if (decl)
|
||||
type = prepare_eh_type (TREE_TYPE (decl));
|
||||
|
@ -438,7 +438,7 @@ expand_start_catch_block (tree decl)
|
|||
|
||||
/* If there's no decl at all, then all we need to do is make sure
|
||||
to tell the runtime that we've begun handling the exception. */
|
||||
if (decl == NULL)
|
||||
if (decl == NULL || decl == error_mark_node)
|
||||
finish_expr_stmt (do_begin_catch ());
|
||||
|
||||
/* If the C++ object needs constructing, we need to do that before
|
||||
|
|
|
@ -569,6 +569,9 @@ pushdecl_maybe_friend (tree x, bool is_friend)
|
|||
|
||||
timevar_push (TV_NAME_LOOKUP);
|
||||
|
||||
if (x == error_mark_node)
|
||||
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
|
||||
|
||||
need_new_binding = 1;
|
||||
|
||||
if (DECL_TEMPLATE_PARM_P (x))
|
||||
|
|
|
@ -14343,7 +14343,6 @@ cp_parser_handler (cp_parser* parser)
|
|||
static tree
|
||||
cp_parser_exception_declaration (cp_parser* parser)
|
||||
{
|
||||
tree decl;
|
||||
cp_decl_specifier_seq type_specifiers;
|
||||
cp_declarator *declarator;
|
||||
const char *saved_message;
|
||||
|
@ -14376,16 +14375,10 @@ cp_parser_exception_declaration (cp_parser* parser)
|
|||
/* Restore the saved message. */
|
||||
parser->type_definition_forbidden_message = saved_message;
|
||||
|
||||
if (type_specifiers.any_specifiers_p)
|
||||
{
|
||||
decl = grokdeclarator (declarator, &type_specifiers, CATCHPARM, 1, NULL);
|
||||
if (decl == NULL_TREE)
|
||||
error ("invalid catch parameter");
|
||||
}
|
||||
else
|
||||
decl = NULL_TREE;
|
||||
if (!type_specifiers.any_specifiers_p)
|
||||
return error_mark_node;
|
||||
|
||||
return decl;
|
||||
return grokdeclarator (declarator, &type_specifiers, CATCHPARM, 1, NULL);
|
||||
}
|
||||
|
||||
/* Parse a throw-expression.
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
2006-07-17 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
|
||||
|
||||
PR c++/28250
|
||||
* g++.dg/eh/catch1.C: New test.
|
||||
* g++.dg/eh/catch2.C: New test.
|
||||
|
||||
2006-07-16 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR c++/28370
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
// PR c++/28250
|
||||
// { dg-do compile }
|
||||
|
||||
template<int> void foo()
|
||||
{
|
||||
try {}
|
||||
catch (int(0)) {} // { dg-error "before" }
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
// PR c++/28250
|
||||
// { dg-do compile }
|
||||
|
||||
void foo()
|
||||
{
|
||||
try {}
|
||||
catch () {} // { dg-error "before" }
|
||||
catch (...) {}
|
||||
}
|
Loading…
Reference in New Issue