3 ! Passing CLASS to TYPE
8 real, allocatable :: B(:)
11 type, extends(t) :: t2
12 complex :: z = cmplx(3.3, 4.4)
15 class(t), allocatable :: x(:)
20 if (size (x) /= 10) STOP 1
21 x = [(t2(a=-i, B=[1*i,2*i,3*i,4*i]), i = 1, 10)]
23 if (x(i)%a /= -i .or. size (x(i)%b) /= 4 &
24 .or. any (x(i)%b /= [1*i,2*i,3*i,4*i])) then
27 if (x(i)%z /= cmplx(3.3, 4.4)) STOP 3
34 call baseExplicit(x, size(x))
36 call classExplicit(x, size(x))
40 if (size (y) /= 10) STOP 5
42 if (y(i)%a /= -i .or. size (y(i)%b) /= 4 &
43 .or. any (y(i)%b /= [1*i,2*i,3*i,4*i])) then
48 subroutine baseExplicit(v, n)
49 integer, intent(in) :: n
51 if (size (v) /= 10) STOP 7
53 if (v(i)%a /= -i .or. size (v(i)%b) /= 4 &
54 .or. any (v(i)%b /= [1*i,2*i,3*i,4*i])) then
58 end subroutine baseExplicit
60 class(t), intent(in) :: z(:)
63 if (size (z) /= 10) STOP 9
65 if (z(i)%a /= -i .or. size (z(i)%b) /= 4 &
66 .or. any (z(i)%b /= [1*i,2*i,3*i,4*i])) then
69 if (z(i)%z /= cmplx(3.3, 4.4)) STOP 11
75 call baseExplicit(z, size(z))
77 subroutine classExplicit(u, n)
78 integer, intent(in) :: n
79 class(t), intent(in) :: u(n)
82 if (size (u) /= 10) STOP 13
84 if (u(i)%a /= -i .or. size (u(i)%b) /= 4 &
85 .or. any (u(i)%b /= [1*i,2*i,3*i,4*i])) then
88 if (u(i)%z /= cmplx(3.3, 4.4)) STOP 15
94 call baseExplicit(u, n)
95 end subroutine classExplicit