-
Notifications
You must be signed in to change notification settings - Fork 13.4k
misc-redundant-expression: expression with calls to a non-pure function is considered as always-true #35853
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Issue is reproducable in Clang-Tidy 6.0.0 |
Still there in Clang-Tidy 7.0.0 |
Reproduced with Clang-Tidy 9.0.1 |
Same thing for Clang-Tidy 10. |
Reproduced with Clang-Tidy 11.0.0: https://godbolt.org/z/6nWMMa |
@EugeneZelenko @Xazax-hun I’ll try to get more attention, as wrong fix-it can be generated because of this. |
This is unrelated to #54011 and even intended to some extent, I believe: Almost every function call might have side effects (and Instead, to fix your example, I'd focus on the assignments. I've opened D122535 to this end. |
Thank you! |
…ant-expression` check Fixes llvm/llvm-project#35853. Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D122535
Extended Description
Clang-Tidy produces a false positive warning about always-true expression (misc-redundant-expression check) if expression contains consequent calls to a non-pure function which have different return values:
The code is taken from GNU Binutils (/ld/ldfile.c) source file.
The text was updated successfully, but these errors were encountered: