+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
/* 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));
/* 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
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))
static tree
cp_parser_exception_declaration (cp_parser* parser)
{
- tree decl;
cp_decl_specifier_seq type_specifiers;
cp_declarator *declarator;
const char *saved_message;
/* 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.
+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
--- /dev/null
+// PR c++/28250
+// { dg-do compile }
+
+template<int> void foo()
+{
+ try {}
+ catch (int(0)) {} // { dg-error "before" }
+}
--- /dev/null
+// PR c++/28250
+// { dg-do compile }
+
+void foo()
+{
+ try {}
+ catch () {} // { dg-error "before" }
+ catch (...) {}
+}