xref: /llvm-project/flang/test/Semantics/resolve47.f90 (revision 6c1ac141d3c98af9738bc77fcb55602cbff7751f)
1! RUN: %python %S/test_errors.py %s %flang_fc1
2module m1
3  !ERROR: Logical constant '.true.' may not be used as a defined operator
4  interface operator(.TRUE.)
5  end interface
6  !ERROR: Logical constant '.false.' may not be used as a defined operator
7  generic :: operator(.false.) => bar
8end
9
10module m2
11  interface operator(+)
12    module procedure foo
13  end interface
14  interface operator(.foo.)
15    module procedure foo
16  end interface
17  interface operator(.ge.)
18    module procedure bar
19  end interface
20contains
21  integer function foo(x, y)
22    logical, intent(in) :: x, y
23    foo = 0
24  end
25  logical function bar(x, y)
26    complex, intent(in) :: x, y
27    bar = .false.
28  end
29end
30
31!ERROR: Intrinsic operator '.le.' may not be used as a defined operator
32use m2, only: operator(.le.) => operator(.ge.)
33!ERROR: Intrinsic operator '.not.' may not be used as a defined operator
34use m2, only: operator(.not.) => operator(.foo.)
35!ERROR: Logical constant '.true.' may not be used as a defined operator
36use m2, only: operator(.true.) => operator(.foo.)
37end
38