2 ! { dg-options "-std=f2008" }
4 ! Test argument checking for C_LOC with subcomponent parameters.
8 type double_vector_item
9 real(kind(1.d0)), allocatable :: v(:)
10 end type double_vector_item
11 type(double_vector_item), allocatable, target :: dbv_pool(:)
12 real(kind(1.d0)), allocatable, target :: vv(:)
18 type(foo), pointer :: v => null()
20 type(foo_item), allocatable :: foo_pool(:)
23 type(foo), pointer :: v(:) => null()
25 type(foo_item2), allocatable :: foo_pool2(:)
30 type(c_ptr) function get_double_vector_address(handle)
31 integer(c_int), intent(in) :: handle
33 if (.true.) then ! The ultimate component is an allocatable target
34 get_double_vector_address = c_loc(dbv_pool(handle)%v) ! OK: Interop type and allocatable
36 get_double_vector_address = c_loc(vv) ! OK: Interop type and allocatable
39 end function get_double_vector_address
42 type(c_ptr) function get_foo_address(handle)
43 integer(c_int), intent(in) :: handle
44 get_foo_address = c_loc(foo_pool(handle)%v)
46 get_foo_address = c_loc(foo_pool2(handle)%v) ! { dg-error "TS 29113: Noninteroperable array at .1. as argument to C_LOC: Expression is a noninteroperable derived type" }
47 end function get_foo_address
50 end module c_vhandle_mod