xref: /llvm-project/flang/test/Semantics/resolve64.f90 (revision d7a1351bb8d74af7fb5ed4b9df3125b193f2984b)
16c1ac141SIvan Zhechev! RUN: %python %S/test_errors.py %s %flang -flogical-abbreviations -fxor-operator
264ab3302SCarolineConcatto
364ab3302SCarolineConcatto! Like m4 in resolve63 but compiled with different options.
464ab3302SCarolineConcatto! Alternate operators are enabled so treat these as intrinsic.
564ab3302SCarolineConcattomodule m4
664ab3302SCarolineConcattocontains
764ab3302SCarolineConcatto  subroutine s1(x, y, z)
864ab3302SCarolineConcatto    logical :: x
964ab3302SCarolineConcatto    real :: y, z
1064ab3302SCarolineConcatto    !ERROR: Operands of .AND. must be LOGICAL; have REAL(4) and REAL(4)
1164ab3302SCarolineConcatto    x = y .a. z
1264ab3302SCarolineConcatto    !ERROR: Operands of .OR. must be LOGICAL; have REAL(4) and REAL(4)
1364ab3302SCarolineConcatto    x = y .o. z
1464ab3302SCarolineConcatto    !ERROR: Operand of .NOT. must be LOGICAL; have REAL(4)
1564ab3302SCarolineConcatto    x = .n. y
1664ab3302SCarolineConcatto    !ERROR: Operands of .NEQV. must be LOGICAL; have REAL(4) and REAL(4)
1764ab3302SCarolineConcatto    x = y .xor. z
1864ab3302SCarolineConcatto    !ERROR: Operands of .NEQV. must be LOGICAL; have REAL(4) and REAL(4)
1964ab3302SCarolineConcatto    x = y .x. y
2064ab3302SCarolineConcatto  end
2164ab3302SCarolineConcattoend
2264ab3302SCarolineConcatto
2364ab3302SCarolineConcatto! Like m4 in resolve63 but compiled with different options.
2464ab3302SCarolineConcatto! Alternate operators are enabled so treat .A. as .AND.
2564ab3302SCarolineConcattomodule m5
2664ab3302SCarolineConcatto  interface operator(.A.)
2764ab3302SCarolineConcatto    logical function f1(x, y)
2864ab3302SCarolineConcatto      integer, intent(in) :: x, y
2964ab3302SCarolineConcatto    end
3064ab3302SCarolineConcatto  end interface
3164ab3302SCarolineConcatto  interface operator(.and.)
3264ab3302SCarolineConcatto    logical function f2(x, y)
3364ab3302SCarolineConcatto      real, intent(in) :: x, y
3464ab3302SCarolineConcatto    end
3564ab3302SCarolineConcatto  end interface
3664ab3302SCarolineConcattocontains
3764ab3302SCarolineConcatto  subroutine s1(x, y, z)
3864ab3302SCarolineConcatto    logical :: x
3964ab3302SCarolineConcatto    complex :: y, z
40*d7a1351bSPeter Klausler    !ERROR: Operands of .AND. must be LOGICAL; have COMPLEX(4) and COMPLEX(4)
4164ab3302SCarolineConcatto    x = y .and. z
42*d7a1351bSPeter Klausler    !ERROR: Operands of .AND. must be LOGICAL; have COMPLEX(4) and COMPLEX(4)
4364ab3302SCarolineConcatto    x = y .a. z
4464ab3302SCarolineConcatto  end
4564ab3302SCarolineConcattoend
46