[Bug fortran/41951] [OOP] Not diagnosing ambiguous operators (TB vs. INTERFACE)

janus at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Nov 16 12:04:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41951

--- Comment #16 from janus at gcc dot gnu.org 2012-11-16 12:04:13 UTC ---
(In reply to comment #15)
> (In reply to comment #14)
> > Comment 12 is fixed with r189022, but comment 11 is still accepted without
> > error.

One way to reject the abstract case in comment 11, would be to just do the
checking, but not add the procedure to the operator list:


Index: gcc/fortran/resolve.c
===================================================================
--- gcc/fortran/resolve.c    (revision 193552)
+++ gcc/fortran/resolve.c    (working copy)
@@ -11539,19 +11539,21 @@ resolve_typebound_intrinsic_op (gfc_symbol* derive
     goto error;

       /* Add target to non-typebound operator list.  */
-      if (!target->specific->deferred && !derived->attr.use_assoc
-      && p->access != ACCESS_PRIVATE)
+      if (!derived->attr.use_assoc && p->access != ACCESS_PRIVATE)
     {
-      gfc_interface *head, *intr;
       if (gfc_check_new_interface (derived->ns->op[op], target_proc,
                        p->where) == FAILURE)
         return FAILURE;
-      head = derived->ns->op[op];
-      intr = gfc_get_interface ();
-      intr->sym = target_proc;
-      intr->where = p->where;
-      intr->next = head;
-      derived->ns->op[op] = intr;
+      if (!target->specific->deferred)
+        {
+          gfc_interface *head, *intr;
+          head = derived->ns->op[op];
+          intr = gfc_get_interface ();
+          intr->sym = target_proc;
+          intr->where = p->where;
+          intr->next = head;
+          derived->ns->op[op] = intr;
+        }
     }
     }



More information about the Gcc-bugs mailing list