Files
clang-p2996/flang/test/Semantics/call28.f90
Peter Klausler bc83d1c655 [flang] Enforce restrictions on intrinsic assignment
When the left-hand side of an intrinsic assignment statement is
polymorphic, the LHS must be a whole allocatable variable or
component and may not be a coarray (10.2.2.1p1(1)).

Differential Revision: https://reviews.llvm.org/D139049
2022-12-02 15:23:38 -08:00

24 lines
674 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 assignment may not be polymorphic unless assignment is to an entire allocatable
!ERROR: Left-hand side of assignment is not definable
!BECAUSE: 'x' is polymorphic in a pure subprogram
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