1 ! RUN: %python %S/test_errors.py %s %flang_fc1
2 ! Exercise ways to define and extend non-type-bound generics
3 ! TODO: crashes compiler (infinite recursion) when build with MSVC
4 ! XFAIL: system-windows
9 interface operator(.eq
.)
10 module procedure
:: eq1
12 generic
:: operator(==) => eq2
14 logical function eq1(x
, y
)
15 type(t1
), intent(in
) :: x
16 type(t2
), intent(in
) :: y
19 logical function eq2(y
, x
)
20 type(t2
), intent(in
) :: y
21 type(t1
), intent(in
) :: x
27 if (a
== b
.and
. b
.eq
. a
) print *, 'ok'
34 interface operator(==)
37 generic
:: operator(.eq
.) => eq4
39 logical function eq3(x
, y
)
40 type(t1
), intent(in
) :: x
41 type(t3
), intent(in
) :: y
44 logical function eq4(y
, x
)
45 type(t3
), intent(in
) :: y
46 type(t1
), intent(in
) :: x
53 if (a
== b
.and
. b
.eq
. a
.and
. a
== c
.and
. c
.eq
. a
) print *, 'ok'
60 logical function eq5(x
, y
)
61 type(t2
), intent(in
) :: x
62 type(t3
), intent(in
) :: y
65 logical function eq6(y
, x
)
66 type(t3
), intent(in
) :: y
67 type(t2
), intent(in
) :: x
71 interface operator(==)
72 module procedure
:: eq5
77 if (a
== b
.and
. b
.eq
. a
.and
. a
== c
.and
. c
.eq
. a
.and
. b
== c
) print *, 'ok'
79 generic
:: operator(.eq
.) => eq6
80 if (a
== b
.and
. b
.eq
. a
.and
. a
== c
.and
. c
.eq
. a
.and
. b
== c
.and
. c
.eq
. b
) print *, 'ok'
84 interface operator(.eq
.)
85 module procedure
:: eq6
87 if (a
== b
.and
. b
.eq
. a
.and
. a
== c
.and
. c
.eq
. a
.and
. b
== c
.and
. c
.eq
. b
) print *, 'ok'