https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98498
Paul Thomas <pault at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|unassigned at gcc dot gnu.org |pault at gcc dot gnu.org --- Comment #1 from Paul Thomas <pault at gcc dot gnu.org> --- Created attachment 49869 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49869&action=edit Fix pending the iterpretation request ! { dg-do compile } ! { dg-options "-fdump-tree-original" } ! ! gfortran.dg/interface_49.f90 ! Tests the fix for PR98498 in which the '==' operator interface was not ! applied to intrinsic type/kind expressions. This meant that the ! interface was not applied to the .eq. expressions in 'star_eq' even ! though the unlimited polymorphic dummies are type compatible with all ! entities. The tree dump used to contain 10 'star_eq's. ! ! Note that overridding intrinsic operators with functions that have ! compliant intrinsic dummies still yields the error "Operator interface ! at (1) conflicts with intrinsic interface", as required by ! F2003(12.3.2.1.1). ! ! Contributed by Paul Thomas <pa...@gcc.gnu.org> ! MODULE mytypes IMPLICIT none TYPE pvar character(len=20) :: name integer :: level end TYPE pvar interface operator (==) module procedure star_eq end interface contains RECURSIVE function star_eq(a,b) ! The recursive attribute should not be required. implicit none class(*), intent(in) ::a,b logical ::star_eq if (.not. same_type_as (a, b)) then star_eq = .false. return end if select type (a) type is (pvar) select type (b) type is (pvar) print *, "a & b are type pvar" if((a%level.eq. b%level) .and. (a%name .eq. b%name)) then star_eq = .true. else star_eq = .false. end if end select class default print *, "class default: returning false" star_eq = .false. end select end function star_eq end MODULE mytypes program test_eq use mytypes implicit none type(pvar) x, y x = pvar('test 1', 100) y = pvar('test 1', 100) write(*, *) x == y x = pvar('test 1', 100) y = pvar('test 2', 100) write(*, *) x == y end program test_eq ! { dg-final { scan-tree-dump-times "star_eq" 12 "original" } }