| 1 |
! { dg-do compile } |
| 2 |
! |
| 3 |
! PR 40039: Procedures as actual arguments: Check intent of arguments |
| 4 |
! |
| 5 |
! Contributed by Janus Weil <[email protected]> |
| 6 |
|
| 7 |
module m |
| 8 |
|
| 9 |
contains |
| 10 |
|
| 11 |
subroutine a(x,f) |
| 12 |
real :: x |
| 13 |
interface |
| 14 |
real function f(y) |
| 15 |
real,intent(in) :: y |
| 16 |
end function |
| 17 |
end interface |
| 18 |
print *,f(x) |
| 19 |
end subroutine |
| 20 |
|
| 21 |
real function func(z) |
| 22 |
real,intent(inout) :: z |
| 23 |
func = z**2 |
| 24 |
end function |
| 25 |
|
| 26 |
subroutine caller |
| 27 |
interface |
| 28 |
real function p(y) |
| 29 |
real,intent(in) :: y |
| 30 |
end function |
| 31 |
end interface |
| 32 |
pointer :: p |
| 33 |
|
| 34 |
call a(4.3,func) ! { dg-error "INTENT mismatch in argument" } |
| 35 |
p => func ! { dg-error "INTENT mismatch in argument" } |
| 36 |
end subroutine |
| 37 |
|
| 38 |
end module |