From: paolo Date: Wed, 12 Jun 2013 14:03:28 +0000 (+0000) Subject: 2013-06-12 Paolo Carlini X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cda0c4b529fbf48afa0c4267d6da44f362d6c3a9;p=thirdparty%2Fgcc.git 2013-06-12 Paolo Carlini PR c++/42021 * parser.c (cp_parser_nested_name_specifier_opt): Avoid emitting again diagnostic already emitted by cp_parser_lookup_name. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@200013 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 144f1fc4edb2..c8a9e127963b 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,8 +1,14 @@ +2013-06-12 Paolo Carlini + + PR c++/42021 + * parser.c (cp_parser_nested_name_specifier_opt): Avoid emitting + again diagnostic already emitted by cp_parser_lookup_name. + 2013-06-11 Jan Hubicka PR c++/57551 - * cp/pt.c (mark_decl_instantiated): Do not export explicit instantiations - of anonymous namespace templates. + * cp/pt.c (mark_decl_instantiated): Do not export explicit + instantiations of anonymous namespace templates. 2013-06-10 Jason Merrill diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 319da218356e..7b4c358d5335 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -5230,10 +5230,16 @@ cp_parser_nested_name_specifier_opt (cp_parser *parser, decl); else if (ambiguous_decls) { - error_at (token->location, - "reference to %qD is ambiguous", - token->u.value); - print_candidates (ambiguous_decls); + // cp_parser_lookup_name has the same diagnostic, + // thus make sure to emit it almost once. + 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