brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.7 KiB · f02a3ab Raw
49 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc12! C721 A type-param-value of * shall be used only3! * to declare a dummy argument,4! * to declare a named constant,5! * in the type-spec of an ALLOCATE statement wherein each allocate-object is6!   a dummy argument of type CHARACTER with an assumed character length,7! * in the type-spec or derived-type-spec of a type guard statement (11.1.11),8!   or9! * in an external function, to declare the character length parameter of the function result.10! Note also C795 for derived types (C721 applies to intrinsic types)11subroutine s(arg)12  character(len=*), pointer :: arg13  character*(*), parameter  :: cvar1 = "abc"14  character*4,  cvar215  character(len=4_4) :: cvar316  !ERROR: An assumed (*) type parameter may be used only for a (non-statement function) dummy argument, associate name, character named constant, or external function result17  character(len=*) :: cvar418 19  type derived(param)20    integer, len :: param21    class(*), allocatable :: x22  end type23  type(derived(34)) :: a24  interface25    function fun()26      character(len=4) :: fun27    end function fun28  end interface29 30  type t(len)31    integer, len :: len32  end type33  !ERROR: An assumed (*) type parameter may be used only for a (non-statement function) dummy argument, associate name, character named constant, or external function result34  type(t(*)), parameter :: p2 = t(123)() ! C79535 36  select type (ax => a%x)37    type is (integer)38      print *, "hello"39    type is (character(len=*))40      print *, "hello"41    class is (derived(param=*))42      print *, "hello"43    class default44      print *, "hello"45  end select46 47  allocate (character(len=*) :: arg)48end subroutine s49