From 38b51d5b7ef1655add0dedf3efb8ae013dc80236 Mon Sep 17 00:00:00 2001 From: Charles Schlosser Date: Tue, 26 Aug 2025 20:04:17 +0000 Subject: [PATCH] Mitigate setConstant regression with custom scalars --- Eigen/src/Core/Fill.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Eigen/src/Core/Fill.h b/Eigen/src/Core/Fill.h index 9d4ecd445..f40d56db6 100644 --- a/Eigen/src/Core/Fill.h +++ b/Eigen/src/Core/Fill.h @@ -78,8 +78,9 @@ template struct eigen_fill_impl { using Scalar = typename Xpr::Scalar; static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(Xpr& dst, const Scalar& val) { + const Scalar val_copy = val; using std::fill_n; - fill_n(dst.data(), dst.size(), val); + fill_n(dst.data(), dst.size(), val_copy); } template static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(Xpr& dst, const SrcXpr& src) {