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

13 lines
392 B
Fortran

! RUN: %python %S/test_errors.py %s %flang_fc1
! 10.2.1.2p1(1)
program test
class(*), allocatable :: pa
class(*), pointer :: pp
class(*), allocatable :: pac[:]
pa = 1 ! ok
!ERROR: Left-hand side of assignment may not be polymorphic unless assignment is to an entire allocatable
pp = 1
!ERROR: Left-hand side of assignment may not be polymorphic if it is a coarray
pac = 1
end