-
Notifications
You must be signed in to change notification settings - Fork 11k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[flang] Preserve errors from generic matching
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
- Loading branch information
Showing
2 changed files
with
42 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
! 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 |