===================================================================
@@ -3685,7 +3685,7 @@ handle_namespace_attrs (tree ns, tree attributes)
/* Push into the scope of the NAME namespace. If NAME is NULL_TREE, then we
select a name that is unique to this compilation unit. */
-void
+bool
push_namespace (tree name)
{
tree d = NULL_TREE;
@@ -3759,7 +3759,11 @@ push_namespace (tree name)
TREE_PUBLIC (d) = 0;
else
TREE_PUBLIC (d) = 1;
- pushdecl (d);
+ if (pushdecl (d) == error_mark_node)
+ {
+ timevar_cond_stop (TV_NAME_LOOKUP, subtime);
+ return false;
+ }
if (anon)
{
/* Clear DECL_NAME for the benefit of debugging back ends. */
@@ -3777,6 +3781,7 @@ push_namespace (tree name)
current_namespace = d;
timevar_cond_stop (TV_NAME_LOOKUP, subtime);
+ return true;
}
/* Pop from the scope of the current namespace. */
===================================================================
@@ -312,7 +312,7 @@ extern tree push_inner_scope (tree);
extern void pop_inner_scope (tree, tree);
extern void push_binding_level (cp_binding_level *);
-extern void push_namespace (tree);
+extern bool push_namespace (tree);
extern void pop_namespace (void);
extern void push_nested_namespace (tree);
extern void pop_nested_namespace (tree);
===================================================================
@@ -17549,7 +17549,11 @@ cp_parser_namespace_definition (cp_parser* parser)
}
/* Start the namespace. */
- push_namespace (identifier);
+ if (!push_namespace (identifier))
+ {
+ cp_parser_skip_to_end_of_block_or_statement (parser);
+ return;
+ }
/* Parse any nested namespace definition. */
if (cp_lexer_next_token_is (parser->lexer, CPP_SCOPE))