76 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc12! C746, C747, and C7483module m4 use ISO_FORTRAN_ENV5 use ISO_C_BINDING6 7 ! C746 If a coarray-spec appears, it shall be a deferred-coshape-spec-list and8 ! the component shall have the ALLOCATABLE attribute.9 10 type testCoArrayType11 real, allocatable, codimension[:] :: allocatableField12 !ERROR: Component 'deferredfield' is a coarray and must have the ALLOCATABLE attribute13 real, codimension[:] :: deferredField14 !ERROR: Component 'pointerfield' is a coarray and must have the ALLOCATABLE attribute15 !ERROR: 'pointerfield' may not have the POINTER attribute because it is a coarray16 real, pointer, codimension[:] :: pointerField17 !ERROR: Component 'realfield' is a coarray and must have the ALLOCATABLE attribute and have a deferred coshape18 real, codimension[*] :: realField19 !ERROR: 'realfield2' is an ALLOCATABLE coarray and must have a deferred coshape20 real, allocatable, codimension[*] :: realField221 end type testCoArrayType22 23 ! C747 If a coarray-spec appears, the component shall not be of type C_PTR or24 ! C_FUNPTR from the intrinsic module ISO_C_BINDING (18.2), or of type 25 ! TEAM_TYPE from the intrinsic module ISO_FORTRAN_ENV (16.10.2).26 27 type goodCoarrayType28 real, allocatable, codimension[:] :: field29 end type goodCoarrayType30 31 type goodTeam_typeCoarrayType32 type(team_type), allocatable :: field33 end type goodTeam_typeCoarrayType34 35 type goodC_ptrCoarrayType36 type(c_ptr), allocatable :: field37 end type goodC_ptrCoarrayType38 39 type goodC_funptrCoarrayType40 type(c_funptr), allocatable :: field41 end type goodC_funptrCoarrayType42 43 type team_typeCoarrayType44 !ERROR: Coarray 'field' may not have type TEAM_TYPE, C_PTR, or C_FUNPTR45 type(team_type), allocatable, codimension[:] :: field46 end type team_typeCoarrayType47 48 type c_ptrCoarrayType49 !ERROR: Coarray 'field' may not have type TEAM_TYPE, C_PTR, or C_FUNPTR50 type(c_ptr), allocatable, codimension[:] :: field51 end type c_ptrCoarrayType52 53 type c_funptrCoarrayType54 !ERROR: Coarray 'field' may not have type TEAM_TYPE, C_PTR, or C_FUNPTR55 type(c_funptr), allocatable, codimension[:] :: field56 end type c_funptrCoarrayType57 58! C748 A data component whose type has a coarray ultimate component shall be a59! nonpointer nonallocatable scalar and shall not be a coarray.60 61 type coarrayType62 real, allocatable, codimension[:] :: goodCoarrayField63 end type coarrayType64 65 type testType66 type(coarrayType) :: goodField67 !ERROR: Pointer 'pointerfield' may not have a coarray potential component '%goodcoarrayfield'68 type(coarrayType), pointer :: pointerField69 !ERROR: Allocatable or array component 'allocatablefield' may not have a coarray ultimate component '%goodcoarrayfield'70 type(coarrayType), allocatable :: allocatableField71 !ERROR: Allocatable or array component 'arrayfield' may not have a coarray ultimate component '%goodcoarrayfield'72 type(coarrayType), dimension(3) :: arrayField73 end type testType74 75end module m76