Fix compilation failure with C++98 compilers
[official-gcc.git] / gcc / testsuite / gfortran.dg / interface_9.f90
blob9d5de338a523ea6b7fb6ad479c37cda01e7162b1
1 ! { dg-do compile }
2 ! Test of the patch for PR30096, in which gfortran incorrectly.
3 ! compared local with host associated interfaces.
4 !
5 ! Based on contribution by Harald Anlauf <anlauf@gmx.de>
7 module module1
8 interface inverse
9 module procedure A, B
10 end interface
11 contains
12 function A (X) result (Y)
13 real :: X, Y
14 Y = 1.0
15 end function A
16 function B (X) result (Y)
17 integer :: X, Y
18 Y = 3
19 end function B
20 end module module1
22 module module2
23 interface inverse
24 module procedure C
25 end interface
26 contains
27 function C (X) result (Y)
28 real :: X, Y
29 Y = 2.0
30 end function C
31 end module module2
33 program gfcbug48
34 use module1, only : inverse
35 call sub ()
36 if (inverse(1.0_4) /= 1.0_4) STOP 1
37 if (inverse(1_4) /= 3_4) STOP 2
38 contains
39 subroutine sub ()
40 use module2, only : inverse
41 if (inverse(1.0_4) /= 2.0_4) STOP 3
42 if (inverse(1_4) /= 3_4) STOP 4
43 end subroutine sub
44 end program gfcbug48