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

Zeyi Xu via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 1 18:48:09 PDT 2026


================
@@ -134,6 +134,17 @@ makeReinitMatcher(const ValueDecl *MovedVariable,
                  // built-in types.
                  binaryOperation(hasOperatorName("="),
                                  hasLHS(ignoringParenImpCasts(DeclRefMatcher))),
+                 // std::tie() assignment: std::tie(a, b) = expr reinitializes
+                 // all variables passed to std::tie because the tuple
+                 // assignment writes back through the stored references.
+                 // ignoringImplicit strips the MaterializeTemporaryExpr that
+                 // Clang inserts when calling operator= on the prvalue tuple.
----------------
zeyi2 wrote:

```suggestion
```

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


More information about the cfe-commits mailing list