5 ! Check that passing a CLASS to a TYPE works
7 ! Based on a test case of Reinhold Bader.
17 type, extends(foo
) :: foo_1
28 elemental
subroutine subpr_elem (x
)
29 type(foo
), intent(inout
):: x
33 subroutine subpr_array (x
)
34 type(foo
), intent(inout
):: x(:)
40 if (x
%i
/= 55) call abort ()
43 subroutine subpr2_array (x
)
45 if (any(x(:)%i
/= 55)) call abort ()
49 class(foo
), allocatable
:: f
54 function g () result(res
)
55 class(foo
), allocatable
:: res(:)
64 class(foo
), allocatable
:: xx
, yy(:)
66 allocate (foo_1
:: xx
)
69 if (xx
%i
/= 3) call abort ()
73 if (xx
%i
/= 3) call abort ()
77 allocate (foo_1
:: yy(2))
80 if (any (yy
%i
/= 3)) call abort ()
83 call subpr_elem (yy(1))
84 if (yy(1)%i
/= 3) call abort ()
88 if (any (yy
%i
/= 3)) call abort ()
91 call subpr_array (yy(1:2))
92 if (any (yy(1:2)%i
/= 3)) call abort ()
94 call subpr2_array (g ())