[clang-tools-extra] [clang-tidy] Fix assignment-in-if-condition false positive in statement expressions (PR #231704)
Daniil Dudkin via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 14 16:01:07 PDT 2026
https://github.com/unterumarmung commented:
Could we add tests for nested statement expressions and overloaded `operator=`?
For example, `if (({ x = 1; ({ y = 2; y; }); }))` should not warn, since neither assignment is the final expression.
On the other hand, `if (({ x = 1; ({ y = 2; }); }))` should warn only for `y = 2`, and `if (({ ({ x = 1; }); }))` should warn for `x = 1`.
It would be worth checking that overloaded assignment follows the same rules.
https://github.com/llvm/llvm-project/pull/231704
More information about the cfe-commits
mailing list