| Issue |
107781
|
| Summary |
[Flang] Compilation error when two arguments are unlimited polymorphic in the definition of defined assignments
|
| Labels |
flang:frontend
|
| Assignees |
|
| Reporter |
ohno-fj
|
```
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)
$
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs