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/70562] New: User defined assignment does not distinguish between ranks


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

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