From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23351 invoked by alias); 28 Jan 2012 20:41:47 -0000 Received: (qmail 23337 invoked by uid 22791); 28 Jan 2012 20:41:46 -0000 X-SWARE-Spam-Status: No, hits=-2.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 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 20:41:33 +0000 From: "dominiq at lps dot ens.fr" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/52024] [OOP] GENERIC operator cannot be resolved Date: Sat, 28 Jan 2012 21:01: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: dominiq at lps dot ens.fr 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: 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/msg03337.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52024 --- Comment #5 from Dominique d'Humieres 2012-01-28 20:41:28 UTC --- With the patch in comment #4 I get [macbook] f90/bug% gfc pr52024.f90 pr52024.f90:46.6: use m_test 1 Error: 'i_equal_t' and 't_equal_i' for GENERIC '==' at (1) are ambiguous pr52024.f90:52.10: print *, t == i 1 Error: Operands of comparison operator '==' at (1) are TYPE(t_test)/INTEGER(4) pr52024.f90:53.10: print *, i == t 1 Error: Operands of comparison operator '==' at (1) are INTEGER(4)/TYPE(t_test) instead of [macbook] f90/bug% gfcp pr52024.f90 pr52024.f90:10.32: generic :: operator(==) => t_equal_i, i_equal_t 1 Error: 't_equal_i' and 'i_equal_t' for GENERIC '==' at (1) are ambiguous pr52024.f90:46.6: use m_test 1 Fatal Error: Can't open module file 'm_test.mod' for reading at (1): No such file or directory without it. However the following test module m_sort implicit none type, abstract :: sort_t contains generic :: operator(.gt.) => gt_cmp procedure :: gt_cmp end type sort_t contains logical function gt_cmp(a,b) class(sort_t), intent(in) :: a, b gt_cmp = .true. end function gt_cmp end module module test use m_sort implicit none type, extends(sort_t) :: sort_int_t integer :: i contains generic :: operator(.gt.) => gt_cmp_int procedure :: gt_cmp_int end type contains logical function gt_cmp_int(a,b) result(cmp) class(sort_int_t), intent(in) :: a, b if (a%i > b%i) then cmp = .true. else cmp = .false. end if end function gt_cmp_int end module (related to pr41951, but I cannot find where I grabbed it) now gives an ICE [macbook] f90/bug% gfc pr41951_3.f90 f951: internal compiler error: in check_generic_tbp_ambiguity, at fortran/resolve.c:10965 ... instead of the error [macbook] f90/bug% gfcp pr41951_3.f90 pr41951_3.f90:21.32: generic :: operator(.gt.) => gt_cmp_int 1 Error: 'gt_cmp_int' and 'gt_cmp' for GENERIC '.gt.' at (1) are ambiguous Note that AFAICT the other tests in pr41951 don't ICE.