bolt/deps/llvm-18.1.8/flang/test/Semantics/pure01.f90

20 lines
477 B
Fortran
Raw Normal View History

2025-02-14 19:21:04 +01:00
! 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