1! RUN: %S/test_errors.sh %s %t %flang_fc1
2! REQUIRES: shell
3subroutine test1
4  !ERROR: Generic interface 'foo' has both a function and a subroutine
5  interface foo
6    subroutine s1(x)
7    end subroutine
8    subroutine s2(x, y)
9    end subroutine
10    function f()
11    end function
12  end interface
13end subroutine
14
15subroutine test2
16  !ERROR: Generic interface 'foo' has both a function and a subroutine
17  interface foo
18    function f1(x)
19    end function
20    subroutine s()
21    end subroutine
22    function f2(x, y)
23    end function
24  end interface
25end subroutine
26
27module test3
28  !ERROR: Generic interface 'foo' has both a function and a subroutine
29  interface foo
30    module procedure s
31    module procedure f
32  end interface
33contains
34  subroutine s(x)
35  end subroutine
36  function f()
37  end function
38end module
39
40subroutine test4
41  type foo
42  end type
43  !ERROR: Generic interface 'foo' may only contain functions due to derived type with same name
44  interface foo
45    subroutine s()
46    end subroutine
47  end interface
48end subroutine
49
50subroutine test5
51  interface foo
52    function f1()
53    end function
54  end interface
55  interface bar
56    subroutine s1()
57    end subroutine
58    subroutine s2(x)
59    end subroutine
60  end interface
61  !ERROR: Cannot call function 'foo' like a subroutine
62  call foo()
63  !ERROR: Cannot call subroutine 'bar' like a function
64  x = bar()
65end subroutine
66