| 1 |
! { dg-do run } |
| 2 |
! |
| 3 |
! PR 45521: [F08] GENERIC resolution with ALLOCATABLE/POINTER and PROCEDURE |
| 4 |
! |
| 5 |
! Contributed by Janus Weil <[email protected]> |
| 6 |
|
| 7 |
module m |
| 8 |
implicit none |
| 9 |
interface testIF |
| 10 |
module procedure test1 |
| 11 |
module procedure test2 |
| 12 |
end interface |
| 13 |
contains |
| 14 |
real function test1 (obj) |
| 15 |
real :: obj |
| 16 |
test1 = obj |
| 17 |
end function |
| 18 |
real function test2 (pr) |
| 19 |
procedure(real) :: pr |
| 20 |
test2 = pr(0.) |
| 21 |
end function |
| 22 |
end module |
| 23 |
|
| 24 |
program test |
| 25 |
use m |
| 26 |
implicit none |
| 27 |
intrinsic :: cos |
| 28 |
|
| 29 |
if (testIF(2.0)/=2.0) STOP 1 |
| 30 |
if (testIF(cos)/=1.0) STOP 2 |
| 31 |
|
| 32 |
end program |