2010-11-30 Tobias Burnus <burnus@net-b.de>
[official-gcc.git] / gcc / testsuite / gfortran.dg / proc_ptr_comp_5.f90
blob216cb4e9b3a4f91a215c43b95a510dedf052a6e3
1 ! { dg-do run }
3 ! PR39630: Fortran 2003: Procedure pointer components.
5 ! Nested types / double component references.
7 ! Contributed by Janus Weil <janus@gcc.gnu.org>
9 abstract interface
10 subroutine as
11 end subroutine
12 integer function af()
13 end function
14 end interface
16 type :: t1
17 procedure(as), pointer, nopass :: s
18 procedure(af), pointer, nopass :: f
19 end type
21 type :: t2
22 type(t1) :: c
23 end type
25 type(t2) :: x
26 integer :: j = 0
28 x%c%s => is
29 call x%c%s
30 if (j/=5) call abort
32 x%c%f => if
33 j=x%c%f()
34 if (j/=42) call abort
36 contains
38 subroutine is
39 j = 5
40 end subroutine
42 integer function if()
43 if = 42
44 end function
46 end