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