mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-17 15:46:44 +00:00

A function in a defined operator generic interface will syntactically have one or two arguments. If a defined operator includes a specific function with 0 or more than 2 dummy arguments, there's no way that it could be invoked by way of the interface. Emit a warning. Differential Revision: https://reviews.llvm.org/D142762
29 lines
806 B
Fortran
29 lines
806 B
Fortran
! RUN: %python %S/test_errors.py %s %flang_fc1
|
|
! Warn about inaccessible specific procedures in a generic defined operator
|
|
module m
|
|
interface operator (.foo.)
|
|
!WARN: OPERATOR(.foo.) function 'noargs' must have 1 or 2 dummy arguments
|
|
module procedure noargs
|
|
!WARN: OPERATOR(.foo.) function 'noargs' must have 1 or 2 dummy arguments
|
|
module procedure threeargs
|
|
end interface
|
|
type t
|
|
contains
|
|
procedure :: bad
|
|
!WARN: OPERATOR(.bar.) function 'bad' should have 1 or 2 dummy arguments
|
|
generic :: operator (.bar.) => bad
|
|
end type
|
|
contains
|
|
real function noargs()
|
|
noargs = 0.
|
|
end
|
|
real function threeargs(fee,fie,foe)
|
|
real, intent(in) :: fee, fie, foe
|
|
end
|
|
function bad(this,x,y)
|
|
type(t) :: bad
|
|
class(t), intent(in) :: this, x, y
|
|
bad = x
|
|
end
|
|
end
|