1! { dg-do run }
2!
3! PR 39630: [F03] Procedure Pointer Components with PASS
4!
5! Contributed by Tobias Burnus <burnus@gcc.gnu.org>
6
7module m
8
9 type :: t
10  integer :: i
11 contains
12  procedure, pass(y) :: foo
13 end type t
14
15contains
16
17 subroutine foo(x,y)
18  type(t),optional :: x
19  class(t) :: y
20  if(present(x)) then
21    print *, 'foo', x%i, y%i
22  else
23    print *, 'foo', y%i
24  end if
25 end subroutine foo
26
27end module m
28
29use m
30type(t) :: t1, t2
31t1%i = 3
32t2%i = 4
33call t1%foo()
34call t2%foo()
35call t1%foo(t2)
36end
37