1! RUN: %S/test_errors.sh %s %t %f18
2! C736 If EXTENDS appears and the type being defined has a coarray ultimate
3! component, its parent type shall have a coarray ultimate component.
4!
5subroutine s()
6  type coarrayParent
7    real,allocatable, codimension[:] :: parentField
8  end type coarrayParent
9
10  type, extends(coarrayParent) :: goodChildType
11    real, allocatable, codimension[:] :: childField
12  end type goodChildType
13
14  type, extends(coarrayParent) :: brotherType
15    real :: brotherField
16  end type brotherType
17
18  type, extends(brotherType) :: grandChildType
19    real, allocatable, codimension[:] :: grandChildField
20  end type grandChildType
21
22  type plainParent
23  end type plainParent
24
25  !ERROR: Type 'badchildtype' has a coarray ultimate component so the type at the base of its type extension chain ('plainparent') must be a type that has a coarray ultimate component
26  type, extends(plainParent) :: badChildType
27    real, allocatable, codimension[:] :: childField
28  end type badChildType
29
30  type, extends(plainParent) :: plainChild
31    real :: realField
32  end type plainChild
33
34  !ERROR: Type 'badchildtype2' has a coarray ultimate component so the type at the base of its type extension chain ('plainparent') must be a type that has a coarray ultimate component
35  type, extends(plainChild) :: badChildType2
36    real, allocatable, codimension[:] :: childField
37  end type badChildType2
38
39  !ERROR: Type 'badchildtype3' has a coarray ultimate component so the type at the base of its type extension chain ('plainparent') must be a type that has a coarray ultimate component
40  type, extends(plainParent) :: badChildType3
41    type(coarrayParent) :: childField
42  end type badChildType3
43
44end subroutine s
45