When searching for a matching specific procedure for a set of actual arguments in a type-bound generic interface for a defined operator, don't discard any error messages that may have been produced for the specific that was found. Tweak the code to preserve those messages and add them to the context's messages, and add a test. Differential Revision: https://reviews.llvm.org/D155966
20 lines
477 B
Fortran
20 lines
477 B
Fortran
! RUN: %python %S/test_errors.py %s %flang_fc1
|
|
! Ensure that an impure bound operator can't be called
|
|
! from a pure context.
|
|
module m
|
|
type t
|
|
contains
|
|
procedure :: binding => func
|
|
generic :: operator(.not.) => binding
|
|
end type
|
|
contains
|
|
impure integer function func(x)
|
|
class(t), intent(in) :: x
|
|
func = 0
|
|
end
|
|
pure integer function test
|
|
!ERROR: Procedure 'func' referenced in pure subprogram 'test' must be pure too
|
|
test = .not. t()
|
|
end
|
|
end
|