<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/107781>107781</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [Flang] Compilation error when two arguments are unlimited polymorphic in the definition of defined assignments
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            flang:frontend
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          ohno-fj
      </td>
    </tr>
</table>

<pre>
    ```
Version of flang-new : 20.0.0(357bd61744bb8cc2b9b07447294fa977e5758550/AArch64
```

When two dummy arguments are `unlimited polymorphic` in the definition of `defined assignments`, a compilation-time error occurs.

The following are the test program, Flang-new, Gfortran and ifort compilation/execution result.

IssueUnPoly03_.f90:
```fortran
program main
 interface assignment(=)
     subroutine das(this,d2)
       class(*), intent(inout) :: this
       class(*), intent(in) :: d2
     end subroutine das
  end interface assignment(=)

  character :: ii = 'c'
  real(8) :: cc = 2.0
  ii=cc
  if(ii .ne. 'p') print*,"221"
  print*,"Pass"
end program main

subroutine das(this,d2)
  class(*), intent(inout) :: this
  class(*), intent(in) :: d2
  select type(this)
  type is(character(*))
     this = 'p'
  class default
     print*,"120"
  end select
  select type(d2)
  type is(real(8))
     if(d2 .ne. 2.0) print*,"121"
 class default
     print*,"122"
  end select
end subroutine das
```

```
$ flang-new IssueUnPoly03_.f90
error: Semantic errors in IssueUnPoly03_.f90
./IssueUnPoly03_.f90:3:17: error: Defined assignment subroutine 'das' conflicts with intrinsic assignment
 subroutine das(this,d2)
 ^^^
./IssueUnPoly03_.f90:11:3: error: No intrinsic or user-defined ASSIGNMENT(=) matches operand types CHARACTER(KIND=1) and REAL(8)
 ii=cc
    ^^^^^
$
```

```
$ gfortran IssueUnPoly03_.f90; ./a.out
 Pass
$
```

```
$ ifort -diag-disable=10448 IssueUnPoly03_.f90
IssueUnPoly03_.f90(3): error #9186: The dummy arguments of the specific procedure defining a defined assignment or defined operator cannot both be unlimited polymorphic.   [DAS]
     subroutine das(this,d2)
----------------^
IssueUnPoly03_.f90(11): error #6054: A CHARACTER data type is required in this context.   [CC]
 ii=cc
-----^
compilation aborted for IssueUnPoly03_.f90 (code 1)
$
```

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycVlGPm0gM_jWTFysIDAR4yANNNr3q7lZVt3f3eBoGE6YCJjczdLv__jQEsiTLrraNokR4PPZnf8Y2N0YeO6Itiz-weL_iva2V3qq6U-vq26pQ5dOWbfzx6--Zn_9N2kjVgaqganh3XHf0CCzMAX3P93yGaRgnRbkJkigqilQILLLCT6IowSyqeJYkFCdxGsc-w0Oea1FvorPlG0fn339q6sA-Kij7tn0Cro99S501wDUB2_h918hWWirhpJqnVulTLQXb-CA7sDVBSZXspB0Rs40_CKiEc-iDLecSd8BBqPYkG-6011a2BKS10qCE6LXx5rC-1gSVahr1KLvjgMU5s2QsnLQ6at46i4cpQe7hY6W01bwD3pUg3cPcH8MD_SDRD0g1mb6xVw4_GdPTX91n1Tz54b9elfkszG_yNjo4S0cY0HI5SkB2lnTFBc2CZ5iycM8wG3Xcx_SFVr2VHUHJDcPU1tIw3JV4rQcgGm6cAsPcHeFu8DFYlZ3qLcPM1YYrj8HGu-_OLpY4u0ZdeQtvPHQn7whwUhc111xY0pMbKYGFe2CYCIbJpKaJNwzTdIZHiEERPX9SkpKFeyEuj5ULQYLXkefsnZw9zOCkpYOTM9wxRMSA4SW067PPQ2bGQxfYSzLPv-9i6hdJ-nl-DDUkLNinE12gXFA4KThJekn9zPi8rNzFiYvTjIsBkHuhed_Ymf517gL0Z3kd6mWAtQzyKlHPEGe0X2MbuC3xzK0rgRe8BnNe3wsZ34D8WskvtstbIUazLr3QQ84eXJdzVD5QyzsrxbnvGddDX7vjMTws9qSQhXmQOGsXs_sXLXceEMNkqN0EhOqqRgpr4FHa2pWblp2RYv42n5P0nrpn8d34fRtwEIyonwHfq5lzpaE3pNfT4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