3 ! Test move_alloc for polymorphic scalars
13 type, extends(base_type
) :: extended_type
15 end type extended_type
17 subroutine myallocate (a
)
18 class(base_type
), allocatable
, intent(inout
) :: a
19 class(base_type
), allocatable
:: tmp
21 allocate (extended_type
:: tmp
)
26 type is(extended_type
)
27 if (tmp
%i
/= 2 .or
. tmp
%j
/= 77) call abort()
34 if (a
%i
/= -44) call abort()
40 call move_alloc (from
=tmp
, to=a
)
43 type is(extended_type
)
44 if (a
%i
/= 5) call abort()
45 if (a
%j
/= 88) call abort()
52 if (allocated (tmp
)) call abort()
53 end subroutine myallocate
59 class(base_type
), allocatable
:: a
65 if (a
%i
/= 2) call abort()
74 type is(extended_type
)
75 if (a
%i
/= 123) call abort()
76 if (a
%j
/= 9498) call abort()