| Issue |
163913
|
| Summary |
[clang-tidy] [bugprone-inc-dec-in-conditions] false positive inside of lambda used in a boolean _expression_
|
| Labels |
|
| Assignees |
|
| Reporter |
dunhor
|
It took a bit of trial and error to figure out exactly how to trigger this, but here's a very simplified example: https://godbolt.org/z/PrGbYd6Gs
```c++
template <typename Func>
auto eval(Func&& fn)
{
return fn();
}
void doit(size_t size)
{
// This gets incorrectly flagged
if (eval([&] {
size_t result = 0;
for (size_t i = 0; i < size; i++)
{
result += i;
}
return result;
}) < 42) throw 42;
}
```
It's warning that `i` is getting incremented and compared against "in the same _expression_" even though those operations are not directly part of the boolean _expression_.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs