[Bug fortran/78108] New: Generic type-bound operator conflicts

damian at sourceryinstitute dot org gcc-bugzilla@gcc.gnu.org
Tue Oct 25 19:23:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78108

            Bug ID: 78108
           Summary: Generic type-bound operator conflicts
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: damian at sourceryinstitute dot org
  Target Milestone: ---

As demonstrate below, binding a generic operator to a type leads to a name
clash if the operator is associated with a procedure whose implementation is in
a submodule. (A workaround is to move procedure implementation into the
module.)

$ cat generic-tbo-submodule.f90 
module foo_interface
  implicit none
  type foo
  contains
    procedure :: add
    generic :: operator(+) => add 
  end type
  interface
    real module function add(lhs,rhs) 
      implicit none
      class(foo), intent(in) :: lhs,rhs
    end function
  end interface
end module
submodule(foo_interface) foo_implementation
contains
  module procedure add
  end procedure
end submodule

$ gfortran -c generic-tbo-submodule.f90 
generic-tbo-submodule.f90:15:23:

 submodule(foo_interface) foo_implementation
                       1
Error: Entity ‘add’ at (1) is already present in the interface

$ gfortran --version
GNU Fortran (GCC) 7.0.0 20160904 (experimental)


More information about the Gcc-bugs mailing list