| 1 |
! { dg-do compile } |
| 2 |
! |
| 3 |
! PR 60507: Passing function call into procedure argument not caught |
| 4 |
! |
| 5 |
! Contributed by Vladimir Fuka <[email protected]> |
| 6 |
|
| 7 |
type :: t |
| 8 |
procedure(g), pointer, nopass :: ppc |
| 9 |
end type |
| 10 |
|
| 11 |
procedure(g), pointer :: pp |
| 12 |
type(t)::x |
| 13 |
|
| 14 |
print *, f(g) |
| 15 |
print *, f(g()) ! { dg-error "Expected a procedure for argument" } |
| 16 |
pp => g |
| 17 |
print *, f(pp) |
| 18 |
print *, f(pp()) ! { dg-error "Expected a procedure for argument" } |
| 19 |
x%ppc => g |
| 20 |
print *, f(x%ppc) |
| 21 |
print *, f(x%ppc()) ! { dg-error "Expected a procedure for argument" } |
| 22 |
|
| 23 |
contains |
| 24 |
|
| 25 |
real function f(fun) |
| 26 |
procedure(g) :: fun |
| 27 |
f = fun() |
| 28 |
end function |
| 29 |
|
| 30 |
real function g() |
| 31 |
g = 1. |
| 32 |
end function |
| 33 |
|
| 34 |
end |