brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.2 KiB · 5275e6f Raw
91 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc12! C737 If EXTENDS appears and the type being defined has a potential 3! subobject component of type EVENT_TYPE or LOCK_TYPE from the intrinsic 4! module ISO_FORTRAN_ENV, its parent type shall be EVENT_TYPE or LOCK_TYPE 5! or have a potential subobject component of type EVENT_TYPE or LOCK_TYPE.6module not_iso_fortran_env7  type event_type8  end type9 10  type lock_type11  end type12end module13 14subroutine C737_a()15  use iso_fortran_env16 17  type lockGrandParentType18    type(lock_type) :: grandParentField19  end type lockGrandParentType20 21  type, extends(lockGrandParentType) :: lockParentType22    real :: parentField23  end type lockParentType24 25  type eventParentType26    type(event_type) :: parentField27  end type eventParentType28 29  type noLockParentType30  end type noLockParentType31 32  type, extends(lockParentType) :: goodChildType133    type(lock_type) :: childField34  end type goodChildType135 36  type, extends(lockParentType) :: goodChildType237    type(event_type) :: childField38  end type goodChildType239 40  type, extends(lock_type) :: goodChildType341    type(event_type) :: childField42  end type goodChildType343 44  type, extends(event_type) :: goodChildType445    type(lock_type) :: childField46  end type goodChildType447 48  !ERROR: Type 'badchildtype1' has an EVENT_TYPE or LOCK_TYPE component, so the type at the base of its type extension chain ('nolockparenttype') must either have an EVENT_TYPE or LOCK_TYPE component, or be EVENT_TYPE or LOCK_TYPE49  type, extends(noLockParentType) :: badChildType150    type(lock_type) :: childField51  end type badChildType152 53  !ERROR: Type 'badchildtype2' has an EVENT_TYPE or LOCK_TYPE component, so the type at the base of its type extension chain ('nolockparenttype') must either have an EVENT_TYPE or LOCK_TYPE component, or be EVENT_TYPE or LOCK_TYPE54  type, extends(noLockParentType) :: badChildType255    type(event_type) :: childField56  end type badChildType257 58  !ERROR: Type 'badchildtype3' has an EVENT_TYPE or LOCK_TYPE component, so the type at the base of its type extension chain ('nolockparenttype') must either have an EVENT_TYPE or LOCK_TYPE component, or be EVENT_TYPE or LOCK_TYPE59  type, extends(noLockParentType) :: badChildType360    type(lockParentType) :: childField61  end type badChildType362 63  !ERROR: Type 'badchildtype4' has an EVENT_TYPE or LOCK_TYPE component, so the type at the base of its type extension chain ('nolockparenttype') must either have an EVENT_TYPE or LOCK_TYPE component, or be EVENT_TYPE or LOCK_TYPE64  type, extends(noLockParentType) :: badChildType465    type(eventParentType) :: childField66  end type badChildType467 68end subroutine C737_a69 70subroutine C737_b()71  use not_iso_fortran_env72 73  type lockParentType74    type(lock_type) :: parentField75  end type lockParentType76 77  type noLockParentType78  end type noLockParentType79 80  ! actually OK since this is not the predefined lock_type81  type, extends(noLockParentType) :: notBadChildType182    type(lock_type) :: childField83  end type notBadChildType184 85  ! actually OK since this is not the predefined event_type86  type, extends(noLockParentType) :: notBadChildType287    type(event_type) :: childField88  end type notBadChildType289 90end subroutine C737_b91