| 1 |
! { dg-do compile } |
| 2 |
! |
| 3 |
! PR 36704: Procedure pointer as function result |
| 4 |
! |
| 5 |
! Contributed by Janus Weil <[email protected]> |
| 6 |
|
| 7 |
module proc_ptr_15 |
| 8 |
|
| 9 |
interface |
| 10 |
function e(x) |
| 11 |
real :: x |
| 12 |
procedure(), pointer :: e |
| 13 |
end function e |
| 14 |
end interface |
| 15 |
|
| 16 |
interface |
| 17 |
function f(x) |
| 18 |
real :: x |
| 19 |
external :: f |
| 20 |
pointer :: f |
| 21 |
end function |
| 22 |
end interface |
| 23 |
|
| 24 |
interface |
| 25 |
function g(x) |
| 26 |
real :: x |
| 27 |
pointer :: g |
| 28 |
external :: g |
| 29 |
end function |
| 30 |
end interface |
| 31 |
|
| 32 |
contains |
| 33 |
|
| 34 |
subroutine point_fun() |
| 35 |
call set_fun(aux) |
| 36 |
end subroutine |
| 37 |
|
| 38 |
subroutine set_fun(y) |
| 39 |
external :: y |
| 40 |
end subroutine |
| 41 |
|
| 42 |
function aux() |
| 43 |
external aux |
| 44 |
pointer aux |
| 45 |
intrinsic sin |
| 46 |
aux => sin |
| 47 |
end function |
| 48 |
|
| 49 |
function foo(x) |
| 50 |
real :: x |
| 51 |
interface |
| 52 |
subroutine foo(i) ! { dg-error "attribute conflicts with" } |
| 53 |
integer :: i |
| 54 |
end subroutine |
| 55 |
end interface |
| 56 |
!pointer :: foo |
| 57 |
end function |
| 58 |
|
| 59 |
end |