From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22168 invoked by alias); 28 Jan 2012 12:39:28 -0000 Received: (qmail 22158 invoked by uid 22791); 28 Jan 2012 12:39:27 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,TW_TB X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 28 Jan 2012 12:39:15 +0000 From: "burnus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/52024] [OOP] GENERIC operator cannot be resolved Date: Sat, 28 Jan 2012 15:12:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: burnus at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: burnus at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Status AssignedTo Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-01/txt/msg03302.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52024 Tobias Burnus changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED AssignedTo|unassigned at gcc dot |burnus at gcc dot gnu.org |gnu.org | --- Comment #4 from Tobias Burnus 2012-01-28 12:38:56 UTC --- (In reply to comment #3) > The question is only: What does that "generic_flag" actually do? Answer: For generic procedures which are not operators one can do: generic (i=4, t=x) which matches both interfaces: function t_equal_i( t, i ) result(res) function i_equal_t( i, t ) result(res) For operators, the "t=" syntax is not possible, the argument order is fixed and, thus, for operators the interface is not ambiguous. Untested patch: Index: gfortran.h =================================================================== --- gfortran.h (Revision 183664) +++ gfortran.h @@ -1118,2 +1118,3 @@ typedef struct gfc_tbp_generic struct gfc_tbp_generic* next; + bool is_operator; } Index: resolve.c =================================================================== --- resolve.c (Revision 183664) +++ resolve.c @@ -10966,2 +10995,3 @@ check_generic_tbp_ambiguity (gfc_tbp_gen gcc_assert (!t2->specific->is_generic); + gcc_assert (t1->is_operator == t2->is_operator); @@ -10984,3 +11014,4 @@ check_generic_tbp_ambiguity (gfc_tbp_gen /* Compare the interfaces. */ - if (gfc_compare_interfaces (sym1, sym2, sym2->name, 1, 0, NULL, 0)) + if (gfc_compare_interfaces (sym1, sym2, sym2->name, !t1->is_operator, 0, + NULL, 0)) { Index: decl.c =================================================================== --- decl.c (Revision 183664) +++ decl.c @@ -8394,2 +8394,4 @@ gfc_match_generic (void) target->next = tb->u.generic; + target->is_operator = ((op_type == INTERFACE_USER_OP) + || (op_type == INTERFACE_INTRINSIC_OP)); tb->u.generic = target;