brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.2 KiB · b01469c Raw
75 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc12! 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-spec4! can appear in an ALLOCATE statement, an ac-spec for an array constructor, and5! in the type specifier of a TYPE GUARD statement6!7! C706 TYPE(derived-type-spec) shall not specify an abstract type (7.5.7).8!   This is for a declaration-type-spec9!10! C796 (R756) The derived-type-spec shall not specify an abstract type (7.5.7).11!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).14subroutine s()15  type, abstract :: abstractType16  end type abstractType17 18  type, extends(abstractType) :: concreteType19  end type concreteType20 21  ! declaration-type-spec22  !ERROR: ABSTRACT derived type may not be used here23  type (abstractType), allocatable :: abstractVar24 25  ! ac-spec for an array constructor26  !ERROR: ABSTRACT derived type may not be used here27  type (abstractType), parameter :: abstractArray(*) = (/ abstractType :: /)28 29  class(*), allocatable :: selector30 31  ! Structure constructor32  !ERROR: ABSTRACT derived type may not be used here33  !ERROR: ABSTRACT derived type 'abstracttype' may not be used in a structure constructor34  type (abstractType) :: abstractVar1 = abstractType()35 36  ! Allocate statement37  !ERROR: ABSTRACT derived type may not be used here38  allocate(abstractType :: abstractVar)39 40  select type(selector)41    ! Type specifier for a type guard statement42    !ERROR: ABSTRACT derived type may not be used here43    type is (abstractType)44  end select45end subroutine s46 47subroutine s1()48  type :: extensible49  end type50  type, bind(c) :: inextensible51  end type52 53  ! This one's OK54  class(extensible), allocatable :: y55 56  !ERROR: Non-extensible derived type 'inextensible' may not be used with CLASS keyword57  class(inextensible), allocatable :: x58end subroutine s159 60subroutine s2()61  type t62    integer i63  end type t64  type, extends(t) :: t265    real x66  end type t267contains68  function f1(dummy)69    class(*) dummy70    type(t) f1(1)71    !ERROR: Cannot have an unlimited polymorphic value in an array constructor72    f1 = [ (dummy) ]73  end function f174end subroutine s275