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

            Bug ID: 70562
           Summary: User defined assignment does not distinguish between
                    ranks
           Product: gcc
           Version: 5.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: baradi09 at gmail dot com
  Target Milestone: ---

User defined assignment for derived types fails to compile, if the signature of
the various assignments only differ in their rank. The snippet further below
fails to compile with the error message

     generic :: assignment(=) => assignScalar, assignArray
                               1
Error: ‘assignscalar’ and ‘assignarray’ for GENERIC ‘=’ at (1) are ambiguous

although the two interfaces are not ambiguous, as their differ in ther ranks.

Best regards, Bálint


module typedefs
  implicit none

  type :: tt
    integer :: data(2)
  contains
    procedure :: assignScalar
    procedure :: assignArray
    generic :: assignment(=) => assignScalar, assignArray
  end type tt

contains

  subroutine assignScalar(this, other)
    class(tt), intent(inout) :: this
    class(*), intent(in) :: other

    print *, "assignScalar"

  end subroutine assignScalar


  subroutine assignArray(this, other)
    class(tt), intent(inout) :: this
    class(*), intent(in) :: other(:)

    print *, "assignScalar"

  end subroutine assignArray

end module typedefs

Reply via email to