3 ! basic tests of PROCEDURE POINTERS
5 ! Contributed by Janus Weil <janus@gcc.gnu.org>
13 integer function proc2(arg
)
14 integer, intent(in
) :: arg
17 complex function proc3(re
, im
)
18 real, intent(in
) :: re
, im
19 proc3
= complex (re
, im
)
31 use m
, only
: proc1
, proc2
, proc3
33 PROCEDURE(proc1
), POINTER :: ptr1
34 PROCEDURE(proc2
), POINTER :: ptr2
35 PROCEDURE(proc3
), POINTER :: ptr3
=> NULL()
36 PROCEDURE(REAL), SAVE, POINTER :: ptr4
37 PROCEDURE(), POINTER :: ptr5
,ptr6
42 if(ASSOCIATED(ptr3
)) call abort()
45 if (ASSOCIATED(ptr1
)) call abort()
47 if (.not
. ASSOCIATED(ptr1
)) call abort()
49 if (str
.ne
. "proc1") call abort ()
52 if (ASSOCIATED(ptr2
)) call abort()
54 if (.not
. ASSOCIATED(ptr2
,proc2
)) call abort()
55 if (10*ptr2 (10) .ne
. 1000) call abort ()
58 if (ASSOCIATED(ptr3
)) call abort()
60 if (ptr3 (1.0, 2.0) .ne
. (1.0, 2.0)) call abort ()
63 if (ptr4(0.0)/=1.0) call abort()
69 if (ptr6()/=6.3) call abort()