1 ! RUN: %python %S/test_errors.py %s %flang_fc1
2 ! C703 (R702) The derived-type-spec shall not specify an abstract type (7.5.7).
3 ! This constraint refers to the derived-type-spec in a type-spec. A type-spec
4 ! can appear in an ALLOCATE statement, an ac-spec for an array constructor, and
5 ! in the type specifier of a TYPE GUARD statement
7 ! C706 TYPE(derived-type-spec) shall not specify an abstract type (7.5.7).
8 ! This is for a declaration-type-spec
10 ! C796 (R756) The derived-type-spec shall not specify an abstract type (7.5.7).
12 ! C705 (R703) In a declaration-type-spec that uses the CLASS keyword,
13 ! derived-type-spec shall specify an extensible type (7.5.7).
15 type, abstract
:: abstractType
18 type, extends(abstractType
) :: concreteType
21 ! declaration-type-spec
22 !ERROR: ABSTRACT derived type may not be used here
23 type (abstractType
), allocatable
:: abstractVar
25 ! ac-spec for an array constructor
26 !ERROR: ABSTRACT derived type may not be used here
27 type (abstractType
), parameter :: abstractArray(*) = (/ abstractType
:: /)
29 class(*), allocatable
:: selector
31 ! Structure constructor
32 !ERROR: ABSTRACT derived type may not be used here
33 !ERROR: ABSTRACT derived type 'abstracttype' may not be used in a structure constructor
34 type (abstractType
) :: abstractVar1
= abstractType()
37 !ERROR: ABSTRACT derived type may not be used here
38 allocate(abstractType
:: abstractVar
)
41 ! Type specifier for a type guard statement
42 !ERROR: ABSTRACT derived type may not be used here
43 type is (abstractType
)
50 type, bind(c
) :: inextensible
54 class(extensible
), allocatable
:: y
56 !ERROR: Non-extensible derived type 'inextensible' may not be used with CLASS keyword
57 class(inextensible
), allocatable
:: x
64 type, extends(t
) :: t2
71 !ERROR: Cannot have an unlimited polymorphic value in an array constructor