Skip to content

[flang] Unexpected compile time failure when resolving a reference to a defined assignment ASSIGNMENT(=) #148675

@DanielCChen

Description

@DanielCChen

Consider the following code:

module m
  type dt
    integer i
  contains
    generic :: ASSIGNMENT(=) => assign
    procedure, pass :: assign => myassign
    generic :: ASSIGNMENT(=) => otherassign               !! If commented out, it compiles successfully
    procedure, pass :: otherassign => myassign            !! If commented out, it compiles successfully
  end type
contains
  subroutine myassign(x,y)
    class(dt), intent(out) :: x
    integer, intent(in) :: y
    x%i = y + 1
  end subroutine

  subroutine sub
    type(dt) xdt
    xdt = 5
  end subroutine
end module

Flang complains:

error: Semantic errors in assign08.f
./assign08.f:19:5: error: No intrinsic or user-defined ASSIGNMENT(=) matches operand types TYPE(dt) and INTEGER(4)
      xdt = 5
      ^^^^^^^

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions