This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[committed] C++: Fix PR11415 ('::::' in error message)


Hi

This patch fixes a bug when printing error message reported as PR11415.
Incorrect diagnostic

  `::::Outer' is not a class-name or namespace-name

is produced.  This is due to the format string %D::%D where the first
argument is 'global_namespace'.  I don't think a testcase for this bug 
in the testsuite would be useful since it can only catch this particular
call to 'error' function.

Patch committed to trunk as obvious.  Tested on i686-pc-linux-gnu with
no regressions.

--Kriang

2003-09-27  Kriang Lerdsuwanakij  <lerdsuwa@users.sourceforge.net>

	PR c++/11413
	* parser.c (cp_parser_nested_name_specifier_opt): Issue correct
	error message when parser->scope is global_namespace.


diff -cprN gcc-main-save/gcc/cp/parser.c gcc-main-new/gcc/cp/parser.c
*** gcc-main-save/gcc/cp/parser.c	Thu Sep 25 19:51:04 2003
--- gcc-main-new/gcc/cp/parser.c	Thu Sep 25 23:08:29 2003
*************** cp_parser_nested_name_specifier_opt (cp_
*** 2997,3002 ****
--- 2997,3006 ----
  			error ("`%T::%D' is not a class-name or "
  			       "namespace-name",
  			       parser->scope, token->value);
+ 		      else if (parser->scope == global_namespace)
+ 			error ("`::%D' is not a class-name or "
+ 			       "namespace-name",
+ 			       token->value);
  		      else
  			error ("`%D::%D' is not a class-name or "
  			       "namespace-name",


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]