diff --git a/Eigen/src/Core/DenseStorage.h b/Eigen/src/Core/DenseStorage.h index ae86b4d11..67507db28 100644 --- a/Eigen/src/Core/DenseStorage.h +++ b/Eigen/src/Core/DenseStorage.h @@ -118,7 +118,11 @@ template class DenseSt DenseStorage(internal::constructor_without_unaligned_array_assert) : m_data(internal::constructor_without_unaligned_array_assert()) {} DenseStorage(const DenseStorage& other) : m_data(other.m_data) {} - DenseStorage& operator=(DenseStorage other) { other.swap(*this); return *this; } + DenseStorage& operator=(const DenseStorage& other) + { + if (this != &other) m_data = other.m_data; + return *this; + } DenseStorage(DenseIndex,DenseIndex,DenseIndex) {} void swap(DenseStorage& other) { std::swap(m_data,other.m_data); } static DenseIndex rows(void) {return _Rows;} @@ -168,7 +172,16 @@ template class DenseStorage class DenseStorage class DenseStorage -void testSingular(MatrixType m, double tol) +void testSingular(const MatrixType& m, double tol) { const int IsComplex = NumTraits::Scalar>::IsComplex; typedef typename internal::conditional, const MatrixType&>::type TriangularType; @@ -126,7 +126,7 @@ void testSingular(MatrixType m, double tol) } template -void testLogThenExp(MatrixType m, double tol) +void testLogThenExp(const MatrixType& m, double tol) { typedef typename MatrixType::Scalar Scalar; Scalar x;