3 ! Test move_alloc for polymorphic scalars
5 ! The following checks that a move_alloc from
6 ! a TYPE to a CLASS works
15 type, extends(base_type
) :: extended_type
17 end type extended_type
19 subroutine myallocate (a
)
20 class(base_type
), allocatable
, intent(inout
) :: a
21 type(extended_type
), allocatable
:: tmp
25 if (tmp
%i
/= 2 .or
. tmp
%j
/= 77) call abort()
31 if (a
%i
/= -44) call abort()
37 call move_alloc (from
=tmp
, to=a
)
40 type is(extended_type
)
41 if (a
%i
/= 5) call abort()
42 if (a
%j
/= 88) call abort()
49 if (allocated (tmp
)) call abort()
50 end subroutine myallocate
56 class(base_type
), allocatable
:: a
62 if (a
%i
/= 2) call abort()
71 type is(extended_type
)
72 if (a
%i
/= 123) call abort()
73 if (a
%j
/= 9498) call abort()