Fix compilation failure with C++98 compilers
[official-gcc.git] / gcc / testsuite / gfortran.dg / pr21177.f90
bloba2085007736c3ecde98b570fb7008dcd1334a6a2
1 ! { dg-do run }
2 ! PR fortran/21177
3 module mymod
4 interface tt
5 module procedure tt_i, tt_r, tt_l, tt_c4, tt_c8
6 end interface tt
7 contains
8 function tt_l(x) result(y)
9 integer :: y
10 logical, pointer :: x
11 y = 0
12 end function
13 function tt_i(x) result(y)
14 integer :: y
15 integer, pointer :: x
16 y = 1
17 end function
18 function tt_r(x) result(y)
19 integer :: y
20 real, pointer :: x
21 y = 2
22 end function
23 function tt_c4(x) result(y)
24 integer :: y
25 complex(4), pointer :: x
26 y = 3
27 end function
28 function tt_c8(x) result(y)
29 integer :: y
30 complex(8), pointer :: x
31 y = 4
32 end function
33 end module mymod
35 program test
36 use mymod
37 logical, pointer :: l
38 integer, pointer :: i
39 real, pointer :: r
40 complex(4), pointer :: c4
41 complex(8), pointer :: c8
43 if (tt(l) /= 0) STOP 1
44 if (tt(i) /= 1) STOP 2
45 if (tt(r) /= 2) STOP 3
46 if (tt(c4) /= 3) STOP 4
47 if (tt(c8) /= 4) STOP 5
48 if (tt(null(l)) /= 0) STOP 6
49 if (tt(null(i)) /= 1) STOP 7
50 if (tt(null(r)) /= 2) STOP 8
51 if (tt(null(c4)) /= 3) STOP 9
52 if (tt(null(c8)) /= 4) STOP 10
53 end program test