diff --git a/Eigen/src/Core/MapBase.h b/Eigen/src/Core/MapBase.h index e79748e7d..72c208bc2 100644 --- a/Eigen/src/Core/MapBase.h +++ b/Eigen/src/Core/MapBase.h @@ -99,7 +99,7 @@ template class MapBase inline const Scalar coeff(int index) const { ei_assert(Derived::IsVectorAtCompileTime || (ei_traits::Flags & LinearAccessBit)); - if ( ((RowsAtCompileTime == 1) == IsRowMajor) ) + if ( ((RowsAtCompileTime == 1) == IsRowMajor) || !int(Derived::IsVectorAtCompileTime) ) return m_data[index]; else return m_data[index*stride()]; @@ -108,7 +108,7 @@ template class MapBase inline Scalar& coeffRef(int index) { ei_assert(Derived::IsVectorAtCompileTime || (ei_traits::Flags & LinearAccessBit)); - if ( ((RowsAtCompileTime == 1) == IsRowMajor) ) + if ( ((RowsAtCompileTime == 1) == IsRowMajor) || !int(Derived::IsVectorAtCompileTime) ) return const_cast(m_data)[index]; else return const_cast(m_data)[index*stride()];