| 1 |
! { dg-do compile } |
| 2 |
! Test the fix for PR42481, in which 'sub' was not recognised as |
| 3 |
! a generic interface. |
| 4 |
! |
| 5 |
! Contributed by William Mitchell < [email protected]> |
| 6 |
! |
| 7 |
module mod1 |
| 8 |
contains |
| 9 |
subroutine sub(x, chr) |
| 10 |
real x |
| 11 |
character(8) chr |
| 12 |
if (trim (chr) .ne. "real") STOP 1 |
| 13 |
if (int (x) .ne. 1) STOP 2 |
| 14 |
end subroutine sub |
| 15 |
end module mod1 |
| 16 |
|
| 17 |
module mod2 |
| 18 |
use mod1 |
| 19 |
interface sub |
| 20 |
module procedure sub, sub_int |
| 21 |
end interface sub |
| 22 |
contains |
| 23 |
subroutine sub_int(i, chr) |
| 24 |
character(8) chr |
| 25 |
integer i |
| 26 |
if (trim (chr) .ne. "integer") STOP 3 |
| 27 |
if (i .ne. 1) STOP 4 |
| 28 |
end subroutine sub_int |
| 29 |
end module mod2 |
| 30 |
|
| 31 |
program prog |
| 32 |
use mod1 |
| 33 |
use mod2 |
| 34 |
call sub(1, "integer ") |
| 35 |
call sub(1.0, "real ") |
| 36 |
end program prog |