[clang-tools-extra] [clang-tidy] Add readability-redundant-lambda-parentheses check (PR #190438)

Victor Chernyakin via cfe-commits cfe-commits at lists.llvm.org
Sat Apr 4 13:30:43 PDT 2026


================
@@ -0,0 +1,19 @@
+// RUN: %check_clang_tidy -std=c++20 %s readability-redundant-lambda-parentheses %t
+
+int main() {
+  // Generic lambdas - should warn in C++20 and later
+  auto a = []<class T>() { return sizeof(T); };
+  // CHECK-MESSAGES: :[[@LINE-1]]:23: warning: redundant empty parameter list in lambda expression [readability-redundant-lambda-parentheses]
+  // CHECK-FIXES: {{^}}  auto a = []<class T> { return sizeof(T); };{{$}}
----------------
localspook wrote:

These regexes are unnecessary after #133756:
```suggestion
  // CHECK-FIXES: auto a = []<class T> { return sizeof(T); };
```

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


More information about the cfe-commits mailing list