aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gfortran.dg/proc_ptr_result_7.f90
blob: b77e40b7b692e33b80261e5af3b2854c73e3865b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
! { dg-do run }
!
! PR 54285: [F03] Calling a PPC with proc-ptr result
!
! Contributed by Janus Weil <janus@gcc.gnu.org>

type :: t
  procedure(a), pointer, nopass :: p
end type

type(t) :: x

! We cannot use "iabs" directly as it is elemental.
abstract interface
  pure integer function interf_iabs(x)
    integer, intent(in) :: x
  end function interf_iabs
end interface
procedure(interf_iabs), pointer :: pp

x%p => a

pp => x%p()

if (pp(-3) /= 3) call abort

contains

  function a() result (b)
    procedure(interf_iabs), pointer :: b
    b => iabs
  end function

end