110 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc1 -pedantic2! C735 If EXTENDS appears, SEQUENCE shall not appear.3! C738 The same private-or-sequence shall not appear more than once in a4! given derived-type-def .5!6! C740 If SEQUENCE appears,7! the type shall have at least one component,8! each data component shall be declared to be of an intrinsic type or of a sequence type,9! the derived type shall not have any type parameter,10! and a type-bound-procedure-part shall not appear.11subroutine s112 integer :: t013 !ERROR: 't0' is not a derived type14 type(t0) :: x15 type :: t116 end type17 type, extends(t1) :: t218 end type19 !ERROR: Derived type 't3' not found20 type, extends(t3) :: t421 end type22 !ERROR: 't0' is not a derived type23 type, extends(t0) :: t524 end type25end subroutine26 27module m128 type t029 end type30end31module m232 type t33 end type34end35module m336 type t037 end type38end39subroutine s240 use m141 use m2, t0 => t42 use m343 !ERROR: Reference to 't0' is ambiguous44 type, extends(t0) :: t145 end type46end subroutine47 48module m449 type :: t150 private51 sequence52 !WARNING: PRIVATE should not appear more than once in derived type components [-Wredundant-attribute]53 private54 !WARNING: SEQUENCE should not appear more than once in derived type components [-Wredundant-attribute]55 sequence56 real :: t1Field57 end type58 type :: t1a59 end type60 !ERROR: A sequence type may not have the EXTENDS attribute61 type, extends(t1a) :: t262 sequence63 integer i64 end type65 type :: t366 sequence67 integer i68 !ERROR: A sequence type may not have a CONTAINS statement69 contains70 end type71 !WARNING: A sequence type should have at least one component [-Wempty-sequence-type]72 type :: emptyType73 sequence74 end type emptyType75 type :: plainType76 real :: plainField77 end type plainType78 type :: sequenceType79 sequence80 real :: sequenceField81 end type sequenceType82 type :: testType83 sequence84 !ERROR: A sequence type data component must either be of an intrinsic type or a derived sequence type85 class(*), allocatable :: typeStarField86 !ERROR: A sequence type data component must either be of an intrinsic type or a derived sequence type87 type(plainType) :: testField188 !WARNING: A sequence type data component that is a pointer to a non-sequence type is not standard [-Wpointer-in-seq-type]89 type(plainType), pointer :: testField1p90 type(sequenceType) :: testField291 procedure(real), pointer, nopass :: procField92 end type testType93 !ERROR: A sequence type may not have type parameters94 type :: paramType(param)95 integer, kind :: param96 sequence97 real :: paramField98 end type paramType99contains100 subroutine s3101 type :: t1102 !ERROR: PRIVATE is only allowed in a derived type that is in a module103 private104 contains105 !ERROR: PRIVATE is only allowed in a derived type that is in a module106 private107 end type108 end109end110