1! RUN: %S/test_errors.sh %s %t %f18 2! Enforce 18.2.3.3 3 4program test 5 use iso_c_binding, only: c_ptr, c_f_pointer 6 type(c_ptr) :: scalarC, arrayC(1) 7 type :: with_pointer 8 integer, pointer :: p 9 end type 10 type(with_pointer) :: coindexed[*] 11 integer, pointer :: scalarIntF, arrayIntF(:) 12 character(len=:), pointer :: charDeferredF 13 integer :: j 14 call c_f_pointer(scalarC, scalarIntF) ! ok 15 call c_f_pointer(scalarC, arrayIntF, [1_8]) ! ok 16 call c_f_pointer(shape=[1_8], cptr=scalarC, fptr=arrayIntF) ! ok 17 call c_f_pointer(scalarC, shape=[1_8], fptr=arrayIntF) ! ok 18 !ERROR: A positional actual argument may not appear after any keyword arguments 19 call c_f_pointer(scalarC, fptr=arrayIntF, [1_8]) 20 !ERROR: CPTR= argument to C_F_POINTER() must be a C_PTR 21 call c_f_pointer(j, scalarIntF) 22 !ERROR: CPTR= argument to C_F_POINTER() must be scalar 23 call c_f_pointer(arrayC, scalarIntF) 24 !ERROR: SHAPE= argument to C_F_POINTER() must appear when FPTR= is an array 25 call c_f_pointer(scalarC, arrayIntF) 26 !ERROR: SHAPE= argument to C_F_POINTER() may not appear when FPTR= is scalar 27 call c_f_pointer(scalarC, scalarIntF, [1_8]) 28 !ERROR: FPTR= argument to C_F_POINTER() may not have a deferred type parameter 29 call c_f_pointer(scalarC, charDeferredF) 30 !ERROR: FPTR= argument to C_F_POINTER() may not be a coindexed object 31 call c_f_pointer(scalarC, coindexed[0]%p) 32end program 33