summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/proc_ptr_comp_pass_3.f90
blob: add025cb050f57fc0020e29a92e3067295a8d90a (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
35
36
! { dg-do run }
!
! PR 39630: [F03] Procedure Pointer Components with PASS
!
! taken from "Fortran 95/2003 explained" (Metcalf, Reid, Cohen, 2004)

type t
  procedure(obp), pointer, pass(x) :: p
  character(100) :: name
end type

abstract interface
  subroutine obp(w,x)
    import :: t
    integer :: w
    class(t) :: x
  end subroutine
end interface

type(t) :: a
a%p => my_obp_sub
a%name = "doodoo"

call a%p(32)

contains

  subroutine my_obp_sub(w,x)
    integer :: w
    class(t) :: x
    if (x%name/="doodoo") call abort()
    if (w/=32) call abort()
  end subroutine

end