summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/proc_ptr_comp_24.f90
blob: 8c935c9ea569a7e77a1562547278e8558df7828c (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
! { dg-do compile }
!
! PR42045: [F03] passing a procedure pointer component to a procedure pointer dummy
!
! Contributed by John McFarland <john.mcfarland@swri.org>

PROGRAM prog
 TYPE object
  PROCEDURE(), POINTER, NOPASS :: f
 END TYPE object
 TYPE container
  TYPE (object), POINTER :: o(:)
 END TYPE container
 TYPE (container) :: c
 TYPE (object) :: o1, o2
 PROCEDURE(), POINTER :: f => NULL()
 o1%f => f
 CALL set_func(o2,f)
 CALL set_func(o2,o1%f)
 ALLOCATE( c%o(5) )
 c%o(5)%f => f
 CALL set_func(o2,c%o(5)%f)
CONTAINS
 SUBROUTINE set_func(o,f)
  TYPE (object) :: o
  PROCEDURE(), POINTER :: f
  o%f => f
 END SUBROUTINE set_func
END PROGRAM prog