Issue 162899
Summary [clang-tidy] `readability-redundant-parentheses` conflicts with suggested `-Wunreachable-code` mitigation
Labels clang-tidy
Assignees
Reporter firewave
    ```cpp
void f(bool b)
{
    if (false && b) {}
}
```

The code above will report the following:
```
<source>:3:18: warning: code will never be executed [-Wunreachable-code]
    3 |     if (false && b) {}
      | ^
<source>:3:9: note: silence by adding parentheses to mark code as explicitly dead
    3 |     if (false && b) {}
      |         ^
      | /* DISABLES CODE */ ( )
```

But addressing that as suggested will lead to a clang-tidy warning:
```
<source>:3:9: warning: redundant parentheses around _expression_ [readability-redundant-parentheses]
    3 | if ((false) && b) {}
      |         ^ ~
```

https://godbolt.org/z/nTvEGrr7c
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to