1 ! RUN: %python %S/test_errors.py %s %flang_fc1
7 ! C746 If a coarray-spec appears, it shall be a deferred-coshape-spec-list and
8 ! the component shall have the ALLOCATABLE attribute.
11 real, allocatable
, codimension
[:] :: allocatableField
12 !ERROR: Component 'deferredfield' is a coarray and must have the ALLOCATABLE attribute
13 real, codimension
[:] :: deferredField
14 !ERROR: Component 'pointerfield' is a coarray and must have the ALLOCATABLE attribute
15 !ERROR: 'pointerfield' may not have the POINTER attribute because it is a coarray
16 real, pointer, codimension
[:] :: pointerField
17 !ERROR: Component 'realfield' is a coarray and must have the ALLOCATABLE attribute and have a deferred coshape
18 real, codimension
[*] :: realField
19 !ERROR: 'realfield2' is an ALLOCATABLE coarray and must have a deferred coshape
20 real, allocatable
, codimension
[*] :: realField2
21 end type testCoArrayType
23 ! C747 If a coarray-spec appears, the component shall not be of type C_PTR or
24 ! 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).
28 real, allocatable
, codimension
[:] :: field
29 end type goodCoarrayType
31 type goodTeam_typeCoarrayType
32 type(team_type
), allocatable
:: field
33 end type goodTeam_typeCoarrayType
35 type goodC_ptrCoarrayType
36 type(c_ptr
), allocatable
:: field
37 end type goodC_ptrCoarrayType
39 type goodC_funptrCoarrayType
40 type(c_funptr
), allocatable
:: field
41 end type goodC_funptrCoarrayType
43 type team_typeCoarrayType
44 !ERROR: Coarray 'field' may not have type TEAM_TYPE, C_PTR, or C_FUNPTR
45 type(team_type
), allocatable
, codimension
[:] :: field
46 end type team_typeCoarrayType
49 !ERROR: Coarray 'field' may not have type TEAM_TYPE, C_PTR, or C_FUNPTR
50 type(c_ptr
), allocatable
, codimension
[:] :: field
51 end type c_ptrCoarrayType
53 type c_funptrCoarrayType
54 !ERROR: Coarray 'field' may not have type TEAM_TYPE, C_PTR, or C_FUNPTR
55 type(c_funptr
), allocatable
, codimension
[:] :: field
56 end type c_funptrCoarrayType
58 ! C748 A data component whose type has a coarray ultimate component shall be a
59 ! nonpointer nonallocatable scalar and shall not be a coarray.
62 real, allocatable
, codimension
[:] :: goodCoarrayField
66 type(coarrayType
) :: goodField
67 !ERROR: A component with a POINTER or ALLOCATABLE attribute may not be of a type with a coarray ultimate component (named 'goodcoarrayfield')
68 type(coarrayType
), pointer :: pointerField
69 !ERROR: A component with a POINTER or ALLOCATABLE attribute may not be of a type with a coarray ultimate component (named 'goodcoarrayfield')
70 type(coarrayType
), allocatable
:: allocatableField
71 !ERROR: An array or coarray component may not be of a type with a coarray ultimate component (named 'goodcoarrayfield')
72 type(coarrayType
), dimension(3) :: arrayField