public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "pault at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/98498] Interp request: defined operators and unlimited polymorphic Date: Sun, 03 Jan 2021 12:22:14 +0000 [thread overview] Message-ID: <bug-98498-4-B2VSHDPhHf@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-98498-4@http.gcc.gnu.org/bugzilla/> 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 <pault@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" } }
next prev parent reply other threads:[~2021-01-03 12:22 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-01-02 9:41 [Bug fortran/98498] New: " pault at gcc dot gnu.org 2021-01-02 9:42 ` [Bug fortran/98498] " pault at gcc dot gnu.org 2021-01-03 12:22 ` pault at gcc dot gnu.org [this message] 2023-11-03 7:11 ` cvs-commit at gcc dot gnu.org 2023-11-03 7:15 ` pault at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-98498-4-B2VSHDPhHf@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).