[clang-tools-extra] [clang-tidy] Prevent false-positive in presence of derived-to-base cast in bugprone.use-after-move (PR #189638)

Zeyi Xu via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 1 21:39:41 PDT 2026


================
@@ -530,6 +542,7 @@ void UseAfterMoveCheck::registerMatchers(MatchFinder *Finder) {
                               hasArgument(0, Arg))),
                unless(inDecltypeOrTemplateArg()),
                unless(hasParent(TryEmplaceMatcher)), expr().bind("call-move"),
+               optionally(hasParent(implicitCastExpr().bind("optional-cast"))),
----------------
zeyi2 wrote:

```suggestion
               optionally(hasParent(implicitCastExpr(
                   hasCastKind(CK_DerivedToBase)).bind("optional-cast"))),
```

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


More information about the cfe-commits mailing list