• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1! RUN: %S/test_errors.sh %s %t %f18
2! C735 If EXTENDS appears, SEQUENCE shall not appear.
3! C738 The same private-or-sequence shall not appear more than once in a
4! 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 s1
12  integer :: t0
13  !ERROR: 't0' is not a derived type
14  type(t0) :: x
15  type :: t1
16  end type
17  type, extends(t1) :: t2
18  end type
19  !ERROR: Derived type 't3' not found
20  type, extends(t3) :: t4
21  end type
22  !ERROR: 't0' is not a derived type
23  type, extends(t0) :: t5
24  end type
25end subroutine
26
27module m1
28  type t0
29  end type
30end
31module m2
32  type t
33  end type
34end
35module m3
36  type t0
37  end type
38end
39subroutine s2
40  use m1
41  use m2, t0 => t
42  use m3
43  !ERROR: Reference to 't0' is ambiguous
44  type, extends(t0) :: t1
45  end type
46end subroutine
47
48module m4
49  type :: t1
50    private
51    sequence
52    private  ! not a fatal error
53    sequence ! not a fatal error
54    real :: t1Field
55  end type
56  type :: t1a
57  end type
58  !ERROR: A sequence type may not have the EXTENDS attribute
59  type, extends(t1a) :: t2
60    sequence
61    integer i
62  end type
63  type :: t3
64    sequence
65    integer i
66  !ERROR: A sequence type may not have a CONTAINS statement
67  contains
68  end type
69  !ERROR: A sequence type must have at least one component
70  type :: emptyType
71    sequence
72  end type emptyType
73  type :: plainType
74    real :: plainField
75  end type plainType
76  type :: sequenceType
77    sequence
78    real :: sequenceField
79  end type sequenceType
80  type :: testType
81    sequence
82    !ERROR: A sequence type data component must either be of an intrinsic type or a derived sequence type
83    class(*), allocatable :: typeStarField
84    !ERROR: A sequence type data component must either be of an intrinsic type or a derived sequence type
85    type(plainType) :: testField1
86    type(sequenceType) :: testField2
87    procedure(real), pointer, nopass :: procField
88  end type testType
89  !ERROR: A sequence type may not have type parameters
90  type :: paramType(param)
91    integer, kind :: param
92    sequence
93    real :: paramField
94  end type paramType
95contains
96  subroutine s3
97    type :: t1
98      !ERROR: PRIVATE is only allowed in a derived type that is in a module
99      private
100    contains
101      !ERROR: PRIVATE is only allowed in a derived type that is in a module
102      private
103    end type
104  end
105end
106