[clang-tools-extra] [clang-tidy] Fix false positive in readability-redundant-parentheses … (PR #192827)

Daniil Dudkin via cfe-commits cfe-commits at lists.llvm.org
Sun May 3 12:23:08 PDT 2026


================
@@ -99,6 +99,26 @@ struct Foo
   }
 };
 
+// Parens used as the object of a member access are not redundant.
+struct Stream {
+  Stream &operator<<(const char *);
+  const char *str() const;
+};
+struct Val {
+  int x;
+};
+struct Iter {
+  Val operator*() const;
+};
+
+void memberAccessOnParen(Stream &s, Iter it) {
----------------
unterumarmung wrote:

Please add positive coverage showing that plainly redundant member-access bases still warn, for example `(foo).x` and `(foo.fooBar()).z`. Without this, the new matcher can hide real redundant-parentheses diagnostics.


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


More information about the cfe-commits mailing list