Hi,
this issue, which originally was about spelling out in the error message
the ambiguous candidates, is by and large fixed. Only, we produce the
whole diagnostic twice for the testcase at issue: first in
cp_parser_lookup_name and then again in
cp_parser_nested_name_specifier_opt. The below fixes that.
Tested x86_64-linux.
Thanks,
Paolo.
///////////////////////
2013-06-11 Paolo Carlini <paolo.carl...@oracle.com>
PR c++/42021
* parser.c (cp_parser_nested_name_specifier_opt): Avoid emitting
again diagnostic already emitted by cp_parser_lookup_name.
Index: parser.c
===================================================================
--- parser.c (revision 199944)
+++ parser.c (working copy)
@@ -5230,10 +5230,14 @@ cp_parser_nested_name_specifier_opt (cp_parser *pa
decl);
else if (ambiguous_decls)
{
- error_at (token->location,
- "reference to %qD is ambiguous",
- token->u.value);
- print_candidates (ambiguous_decls);
+ if (cp_parser_uncommitted_to_tentative_parse_p
+ (parser))
+ {
+ error_at (token->location,
+ "reference to %qD is ambiguous",
+ token->u.value);
+ print_candidates (ambiguous_decls);
+ }
decl = error_mark_node;
}
else