[clang-tools-extra] [clang-tidy] fix false positive of parentheses removal for overloaded operator (PR #192254)

Yanzuo Liu via cfe-commits cfe-commits at lists.llvm.org
Wed May 27 22:18:36 PDT 2026


zwuis wrote:

> Even with the latest changes in this PR, we still fail to detect redundant parentheses in the below cases:
> - in a return statement around the expression, e.g. `return (1 + 2 + 3);`, redundant-parentheses check fails to flag this as redundant
> - initialization in declaration around the initialization expression e.g. `constexpr int e = (1 + 2 + 3);`
> 
> Happy to have some feedback on these as well, if these are indeed genuine issues or not.

I believe this is a false negative. You can open a new issue.

Note a corner case:

```cpp
decltype(auto) f(int x) {
  decltype(auto) y = (x);
  // not equivalent to:
  // = x;

  return (x);
  // not equivalent to:
  // return x;
}
```

https://github.com/llvm/llvm-project/pull/192254


More information about the cfe-commits mailing list