diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h --- a/clang/lib/Sema/TreeTransform.h +++ b/clang/lib/Sema/TreeTransform.h @@ -12748,6 +12748,9 @@ template ExprResult TreeTransform::TransformCXXBindTemporaryExpr(CXXBindTemporaryExpr *E) { + if (auto *Dtor = E->getTemporary()->getDestructor()) + SemaRef.MarkFunctionReferenced(E->getBeginLoc(), + const_cast(Dtor)); return getDerived().TransformExpr(E->getSubExpr()); }