brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.9 KiB · 1594447 Raw
82 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc12! Resolve generic based on number of arguments3subroutine subr14  interface f5    real function s1f1(x)6      optional :: x7    end8    real function s1f2(x, y)9    end10  end interface11  z = f(1.0)12  z = f(1.0, 2.0)13  !ERROR: No specific function of generic 'f' matches the actual arguments14  z = f(1.0, 2.0, 3.0)15end16 17! Elemental and non-element function both match: non-elemental one should be used18subroutine subr219  interface f20    logical elemental function s2f1(x)21      intent(in) :: x22    end23    real function s2f2(x)24      real :: x(10)25    end26  end interface27  real :: x, y(10), z28  logical :: a29  a = f(1.0)30  !ERROR: No intrinsic or user-defined ASSIGNMENT(=) matches operand types LOGICAL(4) and REAL(4)31  a = f(y)32end33 34! Resolve named operator35subroutine s336  interface operator(.foo.)37    pure integer(8) function f_real(x, y)38      real, intent(in) :: x, y39    end40    pure integer(8) function f_integer(x, y)41      integer, intent(in) :: x, y42    end43  end interface44  logical :: a, b, c45  x = y .foo. z  ! OK: f_real46  i = j .foo. k  ! OK: f_integer47  !ERROR: No intrinsic or user-defined .FOO. matches operand types LOGICAL(4) and LOGICAL(4)48  a = b .foo. c49end50 51! Generic resolves successfully but error analyzing call52module m453  real, protected :: x54  real :: y55  interface s56    pure subroutine s101(x)57      real, intent(out) :: x58    end59    subroutine s102(x, y)60      real :: x, y61    end62  end interface63end64subroutine s4a65  use m466  real :: z67  !OK68  call s(z)69end70subroutine s4b71  use m472  !ERROR: Actual argument associated with INTENT(OUT) dummy argument 'x=' is not definable73  !BECAUSE: 'x' is protected in this scope74  call s(x)75end76pure subroutine s4c77  use m478  !ERROR: Actual argument associated with INTENT(OUT) dummy argument 'x=' is not definable79  !BECAUSE: 'y' may not be defined in pure subprogram 's4c' because it is USE-associated80  call s(y)81end82