xref: /llvm-project/flang/test/Semantics/deallocate07.f90 (revision e9a8ab004cc9aae3c45f8b3708176e584b5c23a2)
1! RUN: %python %S/test_errors.py %s %flang_fc1
2
3module m
4  type t1
5  end type
6  type t2
7    class(t2), allocatable :: pc
8  end type
9  class(t1), pointer :: mp1
10  type(t2) :: mv1
11 contains
12  pure subroutine subr(pp1, pp2, mp2)
13    class(t1), intent(in out), pointer :: pp1
14    class(t2), intent(in out) :: pp2
15    type(t2), pointer :: mp2
16    !ERROR: Name in DEALLOCATE statement is not definable
17    !BECAUSE: 'mp1' may not be defined in pure subprogram 'subr' because it is host-associated
18    deallocate(mp1)
19    !ERROR: Name in DEALLOCATE statement is not definable
20    !BECAUSE: 'mv1' may not be defined in pure subprogram 'subr' because it is host-associated
21    deallocate(mv1%pc)
22    !ERROR: Object in DEALLOCATE statement is not deallocatable
23    !BECAUSE: 'pp1' is polymorphic in a pure subprogram
24    deallocate(pp1)
25    !ERROR: Object in DEALLOCATE statement is not deallocatable
26    !BECAUSE: 'pc' is polymorphic in a pure subprogram
27    deallocate(pp2%pc)
28    !ERROR: Object in DEALLOCATE statement is not deallocatable
29    !BECAUSE: 'mp2' has polymorphic component '%pc' in a pure subprogram
30    deallocate(mp2)
31  end subroutine
32end module
33