0
0
mirror of https://gitlab.com/libeigen/eigen.git synced 2026-01-18 17:31:19 +01:00

Fix assignment size assertion for EIGEN_NO_AUTOMATIC_RESIZING.

libeigen/eigen!2108

Closes #3018
This commit is contained in:
Antonio Sánchez
2026-01-15 19:04:53 +00:00
committed by Charles Schlosser
parent 251bff2885
commit 9a37aca9fc

View File

@@ -804,8 +804,17 @@ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void resize_if_allowed(DstXprTyp
const internal::assign_op<T1, T2>& /*func*/) {
Index dstRows = src.rows();
Index dstCols = src.cols();
if (((dst.rows() != dstRows) || (dst.cols() != dstCols))) dst.resize(dstRows, dstCols);
eigen_assert(dst.rows() == dstRows && dst.cols() == dstCols);
if (((dst.rows() != dstRows) || (dst.cols() != dstCols))) {
#ifdef EIGEN_NO_AUTOMATIC_RESIZING
eigen_assert(
(dst.size() == 0 || (DstXprType::IsVectorAtCompileTime ? (dst.size() == src.size())
: (dst.rows() == dstRows && dst.cols() == dstCols))) &&
"Size mismatch. Automatic resizing is disabled because EIGEN_NO_AUTOMATIC_RESIZING is defined");
#else
dst.resize(dstRows, dstCols);
eigen_assert(dst.rows() == dstRows && dst.cols() == dstCols);
#endif
}
}
template <typename DstXprType, typename SrcXprType, typename Functor>