xref: /llvm-project/flang/test/Semantics/resolve74.f90 (revision 41a964cff0068ba417d355b499f10ecedd4a4636)
1! RUN: %python %S/test_errors.py %s %flang_fc1
2! C722 A function name shall not be declared with an asterisk type-param-value
3! unless it is of type CHARACTER and is the name of a dummy function or the
4! name of the result of an external function.
5subroutine s()
6
7  type derived(param)
8    integer, len :: param
9  end type
10  type(derived(34)) :: a
11
12  procedure(character(len=*)) :: externCharFunc
13  !ERROR: An assumed (*) type parameter may be used only for a (non-statement function) dummy argument, associate name, character named constant, or external function result
14  procedure(type(derived(param =*))) :: externDerivedFunc
15
16  interface
17    subroutine subr(dummyFunc)
18      character(len=*) :: dummyFunc
19    end subroutine subr
20  end interface
21
22  contains
23    function works()
24      type(derived(param=4)) :: works
25    end function works
26
27  !ERROR: An assumed (*) type parameter may be used only for a (non-statement function) dummy argument, associate name, character named constant, or external function result
28    function fails1()
29      character(len=*) :: fails1
30    end function fails1
31
32  !ERROR: An assumed (*) type parameter may be used only for a (non-statement function) dummy argument, associate name, character named constant, or external function result
33    function fails2()
34  !ERROR: An assumed (*) type parameter may be used only for a (non-statement function) dummy argument, associate name, character named constant, or external function result
35      type(derived(param=*)) :: fails2
36    end function fails2
37
38end subroutine s
39