An assignment to a whole polymorphic object in a PURE subprogram that is implemented by means of a defined assignment procedure shouldn't be subjected to the same definability checks as it would be for an intrinsic assignment (which would also require it to be allocatable). Fixes https://github.com/llvm/llvm-project/issues/139129.
22 lines
572 B
Fortran
22 lines
572 B
Fortran
! RUN: %python %S/test_errors.py %s %flang_fc1
|
|
|
|
module m1
|
|
type :: t
|
|
end type
|
|
contains
|
|
pure subroutine s1(x)
|
|
class(t), intent(in out) :: x
|
|
call s2(x)
|
|
call s3(x)
|
|
end subroutine
|
|
pure subroutine s2(x)
|
|
class(t), intent(in out) :: x
|
|
!ERROR: Left-hand side of intrinsic assignment may not be polymorphic unless assignment is to an entire allocatable
|
|
x = t()
|
|
end subroutine
|
|
pure subroutine s3(x)
|
|
!ERROR: An INTENT(OUT) dummy argument of a pure subroutine may not be polymorphic
|
|
class(t), intent(out) :: x
|
|
end subroutine
|
|
end module
|