re PR c++/27078 (Duplicate error message for ambiguous enum)
authorJason Merrill <jason@redhat.com>
Fri, 13 Nov 2009 02:20:41 +0000 (21:20 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Fri, 13 Nov 2009 02:20:41 +0000 (21:20 -0500)
PR c++/27078
* parser.c (cp_parser_primary_expression): Don't give a duplicate
ambiguity error.

From-SVN: r154139

gcc/cp/ChangeLog
gcc/cp/parser.c

index aa2563a..988b602 100644 (file)
@@ -1,5 +1,9 @@
 2009-11-12  Jason Merrill  <jason@redhat.com>
 
+       PR c++/27078
+       * parser.c (cp_parser_primary_expression): Don't give a duplicate
+       ambiguity error.
+
        PR c++/39560
        * decl2.c (build_anon_union_vars): Set DECL_ARTIFICIAL.
 
        * call.c (build_conditional_expr): Check specifically for folding
        to CALL_EXPR rather than TREE_SIDE_EFFECTS.
 
-2009-11-12  Jason Merrill  <jason@redhat.com>
-
        * typeck.c (cv_qualified_p): New fn.
        (decay_conversion): Use it.
        * cp-tree.h: Declare it.
        * tree.c (rvalue): Use it and cv_unqualified.
        * init.c (build_aggr_init): Likewise.
 
-2009-11-12  Jason Merrill  <jason@redhat.com>
-
        PR c++/42013
        * call.c (build_conditional_expr): Don't fold a TREE_SIDE_EFFECTS
        COND_EXPR in unevaluated context.
@@ -33,8 +33,6 @@
        PR c++/39131
        * rtti.c (emit_support_tinfos): Add DFP types.
 
-2009-11-11  Jason Merrill  <jason@redhat.com>
-
        * call.c (build_op_delete_call): Downgrade error about
        placement/non-placement confusion to permerror.
 
index 3475723..f77ec55 100644 (file)
@@ -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,