[flang] Accept polymorphic component element in storage_size
[llvm-project.git] / flang / test / Semantics / resolve86.f90
blob15969c74b6ef98ea4e36c8ada169f9fa4a4e7eb3
1 ! RUN: %python %S/test_errors.py %s %flang_fc1
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.
5 subroutine s()
6 type coarrayParent
7 real,allocatable, codimension[:] :: parentField
8 end type coarrayParent
10 type, extends(coarrayParent) :: goodChildType
11 real, allocatable, codimension[:] :: childField
12 end type goodChildType
14 type, extends(coarrayParent) :: brotherType
15 real :: brotherField
16 end type brotherType
18 type, extends(brotherType) :: grandChildType
19 real, allocatable, codimension[:] :: grandChildField
20 end type grandChildType
22 type plainParent
23 end type plainParent
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
30 type, extends(plainParent) :: plainChild
31 real :: realField
32 end type plainChild
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
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
44 end subroutine s