xref: /llvm-project/flang/test/Semantics/call19.f90 (revision 7c71ce97e7be0a00322459527564ad1194e1e4b5)
1! RUN: %python %S/test_errors.py %s %flang_fc1
2! Ensures that things that aren't procedures aren't allowed to be called.
3module m
4  integer :: i
5  integer, pointer :: ip
6  type :: t
7  end type
8  type :: pdt(k,len)
9    integer, kind :: k
10    integer, len :: len
11  end type
12  type(pdt(1,2)) :: x
13  !ERROR: 'i' is not a variable
14  namelist /nml/i
15 contains
16  subroutine s(d)
17    real d
18    !ERROR: 'm' is not a callable procedure
19    call m
20    !ERROR: Cannot call function 'i' like a subroutine
21    call i
22    !ERROR: Cannot call function 'ip' like a subroutine
23    call ip
24    !ERROR: 't' is not a callable procedure
25    call t
26    !ERROR: 'k' is not a procedure
27    call x%k
28    !ERROR: 'len' is not a procedure
29    call x%len
30    !ERROR: Use of 'nml' as a procedure conflicts with its declaration
31    call nml
32    !ERROR: Cannot call function 'd' like a subroutine
33    call d
34  end subroutine
35end
36