Issue |
97972
|
Summary |
[clang-tidy] false positive on bugprone-assignment-in-if-condition with a requires clause in if
|
Labels |
clang-tidy
|
Assignees |
|
Reporter |
qbojj
|
Tested on 902fb1b4653d5a23613492406cd5693446f06ab6
# Steps to reproduce:
test.cpp
```c++
int main() {
if constexpr (requires (int &a) { a = 0; }) {}
}
```
```sh
clang-tidy --checks=bugprone-assignment-in-if-condition ./test.cpp -- -std=c++20
```
## result:
```
1 warning generated.
test.cpp:2:38: warning: an assignment within an 'if' condition is bug-prone [bugprone-assignment-in-if-condition]
2 | if constexpr (requires (int &a) { a = 3; }) {}
| ~~^~~
test.cpp:2:38: note: if it should be an assignment, move it out of the 'if' condition
test.cpp:2:38: note: if it is meant to be an equality check, change '=' to '=='
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs