diff --git a/thrift/lib/thrift/detail/DynamicPatch.h b/thrift/lib/thrift/detail/DynamicPatch.h index 119f3703241..2a03a91a413 100644 --- a/thrift/lib/thrift/detail/DynamicPatch.h +++ b/thrift/lib/thrift/detail/DynamicPatch.h @@ -584,8 +584,9 @@ class DynamicPatch { private: template - static void visitPatchImpl(Self&& self, detail::Badge, Visitor&& visitor) { - std::visit( + static decltype(auto) visitPatchImpl( + Self&& self, detail::Badge, Visitor&& visitor) { + return std::visit( std::forward(visitor), *std::forward(self).patch_); }