[clang-tools-extra] [clang-tidy] Fix false positive in bugprone-use-after-move for std::tie (PR #192895)

Baranov Victor via cfe-commits cfe-commits at lists.llvm.org
Wed May 6 07:29:16 PDT 2026


================
@@ -1789,4 +1790,55 @@ void Run() {
   RegularReset(db6);
   db6.Query();
 }
+
 } // namespace custom_reinitialization
+
+// Tests for std::tie() reinitialization.
+std::pair<std::string, std::string> makeStringPair(std::string a,
+                                                   std::string b);
+
+void stdTieIsReinit() {
+  // std::tie on the LHS reinitializes all captured variables.
+  std::string a, b;
+  std::move(a);
+  std::move(b);
+  std::tie(a, b) = makeStringPair("x", "y"); // no-warning: both reinitialized
----------------
vbvictor wrote:

Add tests with 3 or more variables with tie.


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


More information about the cfe-commits mailing list