[clang-tools-extra] [clang-tidy] Fix some false positive in bugprone-move-forwarding-reference (PR #191435)

Zeyi Xu via cfe-commits cfe-commits at lists.llvm.org
Sun Apr 19 07:15:40 PDT 2026


================
@@ -111,3 +111,15 @@ template <typename T> void f12() {
   // CHECK-MESSAGES: :[[@LINE-1]]:27: warning: forwarding reference passed to
   // CHECK-FIXES: [] (auto&& x) { T SomeT(std::forward<decltype(x)>(x)); };
 }
+
+// Ignore the case of captured variables where an implicit copy already
+// happened. Explicit capture version.
+template <typename T, typename U> void f13(U&& SomeU) {
+  [SomeU] () { T SomeT(std::move(SomeU)); };
----------------
zeyi2 wrote:

Can we add testcases like `[&SomeU] () { T SomeT(std::move(SomeU)); };`?

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


More information about the cfe-commits mailing list