3 ! PR39630: Fortran 2003: Procedure pointer components.
5 ! test case taken from:
6 ! http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/4a827e8ced6efb0f/884b9eca6d7e6742?#884b9eca6d7e6742
7 ! http://fortranwiki.org/fortran/show/proc_component_example
9 module proc_component_example
13 procedure(print_int
), pointer, &
18 subroutine print_int (arg
, lun
)
20 type(t
), intent(in
) :: arg
21 integer, intent(in
) :: lun
22 end subroutine print_int
29 subroutine print_me (arg
, lun
)
30 type(t
), intent(in
) :: arg
31 integer, intent(in
) :: lun
34 end subroutine print_me
36 subroutine print_my_square (arg
, lun
)
37 type(t
), intent(in
) :: arg
38 integer, intent(in
) :: lun
39 write (lun
,*) arg
%a
**2
41 end subroutine print_my_square
43 end module proc_component_example
47 use proc_component_example
48 use iso_fortran_env
, only
: output_unit
55 call x
%proc(x
, output_unit
)
56 x
%proc
=> print_my_square
57 call x
%proc(x
, output_unit
)
59 if (calls
/=2) call abort