Mitigate setConstant regression with custom scalars
diff --git a/Eigen/src/Core/Fill.h b/Eigen/src/Core/Fill.h
index 9d4ecd4..f40d56d 100644
--- a/Eigen/src/Core/Fill.h
+++ b/Eigen/src/Core/Fill.h
@@ -78,8 +78,9 @@
struct eigen_fill_impl<Xpr, /*use_fill*/ true> {
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 <typename SrcXpr>
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(Xpr& dst, const SrcXpr& src) {