This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/37425] New: Fortran 2003: GENERIC bindings as operators


GENERIC type-bound procedures are currently implemented in gfortran, but only
by name and not as operators as in the following example (the polymorphic
passed-object problem included):

MODULE m
  IMPLICIT NONE

  TYPE :: t
    INTEGER :: i
  CONTAINS
    PROCEDURE :: assign_t_from_int
    PROCEDURE :: equals_t_int
    GENERIC :: ASSIGNMENT(=) => assign_t_from_int
    GENERIC :: OPERATOR(==) => equals_t_int
  END TYPE t

CONTAINS

  SUBROUTINE assign_t_from_int (me, i)
    IMPLICIT NONE
    TYPE(t), INTENT(OUT) :: me
    INTEGER, INTENT(IN) :: i
    me = t (i)
  END SUBROUTINE assign_t_from_int

  LOGICAL FUNCTION equals_t_int (me, i)
    IMPLICIT NONE
    TYPE(t) :: me
    INTEGER :: i
    equals_t_int = (me%i == i)
  END FUNCTION equals_t_int

END MODULE m


-- 
           Summary: Fortran 2003: GENERIC bindings as operators
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: domob at gcc dot gnu dot org


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]