Break circular dependency between FIR dialect and utilities
[llvm-project.git] / flang / test / Semantics / generic03.f90
blob829780f52174f428e97f1360348567342e728b07
1 ! RUN: %python %S/test_errors.py %s %flang_fc1
2 ! Exercise function vs subroutine distinction in generics
3 module m1
4 type t1
5 integer n
6 end type
7 interface g1
8 integer function f1(x, j)
9 import t1
10 class(t1), intent(in out) :: x
11 integer, intent(in) :: j
12 end
13 end interface
14 end module
16 program test
17 use m1
18 !WARNING: Generic interface 'g1' has both a function and a subroutine
19 interface g1
20 subroutine s1(x, a)
21 import t1
22 class(t1), intent(in out) :: x
23 real, intent(in) :: a
24 end subroutine
25 end interface
26 type(t1) :: x
27 print *, g1(x,1) ! ok
28 !ERROR: No specific function of generic 'g1' matches the actual arguments
29 print *, g1(x,1.)
30 !ERROR: No specific subroutine of generic 'g1' matches the actual arguments
31 call g1(x,1)
32 call g1(x, 1.) ! ok
33 contains
34 end