[flang] Accept polymorphic component element in storage_size
[llvm-project.git] / flang / test / Semantics / deallocate07.f90
blob2a3d036ec0b6696f9665b18a25016b1770909ac6
1 ! RUN: %python %S/test_errors.py %s %flang_fc1
3 module m
4 type t1
5 end type
6 type t2
7 class(t2), allocatable :: pc
8 end type
9 contains
10 pure subroutine subr(pp1, pp2, mp2)
11 class(t1), intent(in out), pointer :: pp1
12 class(t2), intent(in out) :: pp2
13 type(t2), pointer :: mp2
14 !ERROR: 'pp1' may not be deallocated in a pure procedure because it is polymorphic
15 deallocate(pp1)
16 !ERROR: 'pc' may not be deallocated in a pure procedure because it is polymorphic
17 deallocate(pp2%pc)
18 !ERROR: 'mp2' may not be deallocated in a pure procedure because its type has a polymorphic allocatable ultimate component 'pc'
19 deallocate(mp2)
20 end subroutine
21 end module