3 ! Test that PR67471 is fixed. Used not to call the finalizer.
5 ! Contributed by Ian Harvey <ian_harvey@bigpond.com>
12 final
:: destroy_scalar
, destroy_rank1_array
14 integer :: final_calls
= 0
16 subroutine destroy_rank1_array(self
)
17 type(my_final
), intent(inout
) :: self(:)
18 if (size(self
) /= 0) then
19 if (size(self
) /= 2) stop 1
20 if (any (self
%n
/= [3,4])) stop 2
24 final_calls
= final_calls
+ 1
25 end subroutine destroy_rank1_array
27 ! Eliminate the warning about the lack of a scalar finalizer.
28 subroutine destroy_scalar(self
)
29 type(my_final
), intent(inout
) :: self
30 final_calls
= final_calls
+ self
%n
31 end subroutine destroy_scalar
33 end module test_final_mod
35 program test_finalizer
38 type(my_final
) :: b(4), c(2)
43 if (final_calls
/= 1) stop 4
44 end program test_finalizer