2 ! Test typebound elemental functions on class arrays
8 procedure, pass :: disp => disp_t1
11 type, extends(t1) :: t2
14 procedure, pass :: disp => disp_t2
18 integer elemental function disp_t1 (q)
19 class(t1), intent(in) :: q
23 integer elemental function disp_t2 (q)
24 class(t2), intent(in) :: q
30 class(t1), allocatable :: x(:)
31 allocate (x(4), source = [(t1 (i), i=1,4)])
32 if (any (x%disp () .ne. [1,2,3,4])) STOP 1
33 if (any (x(2:3)%disp () .ne. [2,3])) STOP 2
34 if (any (x(4:3:-1)%disp () .ne. [4,3])) STOP 3
35 if (x(4)%disp () .ne. 4) STOP 4
38 allocate (x(4), source = [(t2 (2 * i, real (i) + 0.333), i=1,4)])
39 if (any (x%disp () .ne. [1,2,3,4])) STOP 5
40 if (any (x(2:3)%disp () .ne. [2,3])) STOP 6
41 if (any (x(4:3:-1)%disp () .ne. [4,3])) STOP 7
42 if (x(4)%disp () .ne. 4) STOP 8