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]

C++ PATCH for c++/27078 (duplicate error about ambiguous lookup)


There was already code in the parser for only giving the ambiguous lookup once, which just needed to be extended to cp_parser_primary_expression.

Tested x86_64-pc-linux-gnu, applied to trunk.

commit af7287900a0caece7297e57816e9e33e38943111
Author: Jason Merrill <jason@redhat.com>
Date:   Thu Nov 12 18:31:52 2009 -0500

    	PR c++/27078
    	* parser.c (cp_parser_primary_expression): Don't give a duplicate
    	ambiguity error.

diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 3475723..f77ec55 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -3509,6 +3509,16 @@ cp_parser_primary_expression (cp_parser *parser,
 	  {
 	    tree ambiguous_decls;
 
+	    /* If we already know that this lookup is ambiguous, then
+	       we've already issued an error message; there's no reason
+	       to check again.  */
+	    if (id_expr_token->type == CPP_NAME
+		&& id_expr_token->ambiguous_p)
+	      {
+		cp_parser_simulate_error (parser);
+		return error_mark_node;
+	      }
+
 	    decl = cp_parser_lookup_name (parser, id_expression,
 					  none_type,
 					  template_p,

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