Break circular dependency between FIR dialect and utilities
[llvm-project.git] / flang / test / Semantics / resolve73.f90
blob1ec9f09c44be78bae2115f5f0acf8fab4aa4785d
1 ! RUN: %python %S/test_errors.py %s %flang_fc1
2 ! C721 A type-param-value of * shall be used only
3 ! * to declare a dummy argument,
4 ! * to declare a named constant,
5 ! * in the type-spec of an ALLOCATE statement wherein each allocate-object is
6 ! 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 ! or
9 ! * in an external function, to declare the character length parameter of the function result.
10 subroutine s(arg)
11 character(len=*), pointer :: arg
12 character*(*), parameter :: cvar1 = "abc"
13 character*4, cvar2
14 character(len=4_4) :: cvar3
15 !ERROR: An assumed (*) type parameter may be used only for a (non-statement function) dummy argument, associate name, named constant, or external function result
16 character(len=*) :: cvar4
18 type derived(param)
19 integer, len :: param
20 class(*), allocatable :: x
21 end type
22 type(derived(34)) :: a
23 interface
24 function fun()
25 character(len=4) :: fun
26 end function fun
27 end interface
29 select type (ax => a%x)
30 type is (integer)
31 print *, "hello"
32 type is (character(len=*))
33 print *, "hello"
34 class is (derived(param=*))
35 print *, "hello"
36 class default
37 print *, "hello"
38 end select
40 allocate (character(len=*) :: arg)
41 end subroutine s