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) STOP 1
31 if (a
%i
/= -44) STOP 2
37 call move_alloc (from
=tmp
, to=a
)
40 type is(extended_type
)
49 if (allocated (tmp
)) STOP 7
50 end subroutine myallocate
56 class(base_type
), allocatable
:: a
71 type is(extended_type
)
72 if (a
%i
/= 123) STOP 10
73 if (a
%j
/= 9498) STOP 11