3 ! PR 40164: Fortran 2003: "Arrays of procedure pointers" (using PPCs)
5 ! Original test case by Barron Bichon <barron.bichon@swri.org>
6 ! Adapted by Janus Weil <janus@gcc.gnu.org>
11 FUNCTION fn_template(n
,x
) RESULT(y
)
12 INTEGER, INTENT(in
) :: n
13 REAL, INTENT(in
) :: x(n
)
15 END FUNCTION fn_template
19 PROCEDURE(fn_template
), POINTER, NOPASS
:: f
23 PROCEDURE(add
), POINTER, NOPASS
:: f
24 END TYPE ProcPointerArray
26 TYPE (ProcPointerArray
) :: f_array(3)
27 PROCEDURE(add
), POINTER :: f
33 f_array(3)%f
=> f_array(1)%f
36 if (abs(r
-3.)>1E-3) call abort()
37 r
= f_array(1)%f(4.,2.)
38 if (abs(r
-6.)>1E-3) call abort()
39 r
= f_array(2)%f(5.,3.)
40 if (abs(r
-2.)>1E-3) call abort()
41 if (abs(f_array(1)%f(1.,3.)-f_array(3)%f(2.,2.))>1E-3) call abort()
45 FUNCTION add(a
,b
) RESULT(sum
)
46 REAL, INTENT(in
) :: a
, b
51 FUNCTION sub(a
,b
) RESULT(diff
)
52 REAL, INTENT(in
) :: a
, b