PR30891: poor diagnostic with namespace in the function scope

Manuel López-Ibáñez
Mon Mar 12 03:32:00 GMT 2007


When a namespace definition is found in function scope, the current
error is far from helpful. This patch gives a clear message for this
particular case.

Bootstrapped + regression tested.

OK for mainline?

2007-03-12  Manuel Lopez-Ibanez  <>

  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

  * g++.dg/parse/namespace-definition.C: New.

More information about the Gcc-patches mailing list