This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[committed] C++: Fix PR11415 ('::::' in error message)
- From: Kriang Lerdsuwanakij <lerdsuwa at users dot sourceforge dot net>
- To: <gcc-patches at gcc dot gnu dot org>
- Date: Sat, 27 Sep 2003 23:46:06 +0700 (ICT)
- Subject: [committed] C++: Fix PR11415 ('::::' in error message)
- Reply-to: <lerdsuwa at users dot sourceforge dot net>
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",