| 1 |
! { dg-do compile } |
| 2 |
! { dg-options "-std=f2003" } |
| 3 |
! Test that the arg checking for c_funloc verifies the procedures are |
| 4 |
! C interoperable. |
| 5 |
module c_funloc_tests_5 |
| 6 |
use, intrinsic :: iso_c_binding, only: c_funloc, c_funptr |
| 7 |
contains |
| 8 |
subroutine sub0() bind(c) |
| 9 |
type(c_funptr) :: my_c_funptr |
| 10 |
|
| 11 |
my_c_funptr = c_funloc(sub1) ! { dg-error "Fortran 2018: Noninteroperable procedure at .1. to C_FUNLOC" } |
| 12 |
|
| 13 |
my_c_funptr = c_funloc(func0) ! { dg-error "Fortran 2018: Noninteroperable procedure at .1. to C_FUNLOC" } |
| 14 |
end subroutine sub0 |
| 15 |
|
| 16 |
subroutine sub1() |
| 17 |
end subroutine sub1 |
| 18 |
|
| 19 |
function func0(desired_retval) |
| 20 |
use, intrinsic :: iso_c_binding, only: c_int |
| 21 |
integer(c_int), value :: desired_retval |
| 22 |
integer(c_int) :: func0 |
| 23 |
func0 = desired_retval |
| 24 |
end function func0 |
| 25 |
end module c_funloc_tests_5 |
| 26 |
|
| 27 |
|