PR30891: poor diagnostic with namespace in the function scope

Manuel López-Ibáñez lopezibanez@gmail.com
Mon Mar 12 03:32:00 GMT 2007


:ADDPATCH C++:

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  <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.

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



More information about the Gcc-patches mailing list