diff options
author | Volker Reichelt <reichelt@igpm.rwth-aachen.de> | 2006-07-17 04:42:24 +0000 |
---|---|---|
committer | Volker Reichelt <reichelt@gcc.gnu.org> | 2006-07-17 04:42:24 +0000 |
commit | 2a50edcd0f5cca974fe82b27a1b109618afa1a05 (patch) | |
tree | 215431855ee45679fe617055909a44fafef8e7f9 /gcc/cp/parser.c | |
parent | 23be7a669151a833b7ab99a657082ce72a9ae3fd (diff) | |
download | gcc-2a50edcd0f5cca974fe82b27a1b109618afa1a05.zip gcc-2a50edcd0f5cca974fe82b27a1b109618afa1a05.tar.gz gcc-2a50edcd0f5cca974fe82b27a1b109618afa1a05.tar.bz2 |
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
Diffstat (limited to 'gcc/cp/parser.c')
-rw-r--r-- | gcc/cp/parser.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index a2d41f1..c422401 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -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. |