• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1! RUN: %S/test_errors.sh %s %t %f18
2! Test resolution of type-bound generics.
3
4module m1
5  type :: t
6  contains
7    procedure, pass(x) :: add1 => add
8    procedure, nopass :: add2 => add
9    procedure :: add_real
10    generic :: g => add1, add2, add_real
11  end type
12contains
13  integer function add(x, y)
14    class(t), intent(in) :: x, y
15  end
16  integer function add_real(x, y)
17    class(t), intent(in) :: x
18    real, intent(in) :: y
19  end
20  subroutine test1(x, y, z)
21    type(t) :: x
22    integer :: y
23    integer :: z
24    !ERROR: No specific procedure of generic 'g' matches the actual arguments
25    z = x%g(y)
26  end
27  subroutine test2(x, y, z)
28    type(t) :: x
29    real :: y
30    integer :: z
31    !ERROR: No specific procedure of generic 'g' matches the actual arguments
32    z = x%g(x, y)
33  end
34end
35