2007-03-15 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+ PR c++/30891
+ * parser.c (cp_parser_statement): If 'namespace' is found, this
+ only can be a namespace alias definition, so parse it now.
+ (cp_parser_namespace_alias_definition): if we find an open brace
+ instead of '=', then this is actually a misplaced namespace
+ definition.
+
+2007-03-15 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
PR c++/24924
* decl.c (cxx_init_decl_processing): Move command-line options
processing to c-opts.c.
statement = cp_parser_try_block (parser);
break;
+ case RID_NAMESPACE:
+ /* This must be a namespace alias definition. */
+ cp_parser_declaration_statement (parser);
+ return;
+
default:
/* It might be a keyword like `int' that can start a
declaration-statement. */
if (identifier == error_mark_node)
return;
/* Look for the `=' token. */
+ if (!cp_parser_uncommitted_to_tentative_parse_p (parser)
+ && cp_lexer_next_token_is (parser->lexer, CPP_OPEN_BRACE))
+ {
+ error ("%<namespace%> definition is not allowed here");
+ /* Skip the definition. */
+ cp_lexer_consume_token (parser->lexer);
+ cp_parser_skip_to_closing_brace (parser);
+ cp_lexer_consume_token (parser->lexer);
+ return;
+ }
cp_parser_require (parser, CPP_EQ, "`='");
/* Look for the qualified-namespace-specifier. */
namespace_specifier
2007-03-15 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+ PR c++/30891
+ * g++.dg/parse/namespace-definition.C: New.
+
+2007-03-15 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
PR c++/24924
* g++.dg/cpp/pedantic-errors.C: New.
* g++.dg/cpp/permissive.C: New.