From c83b754ee0c65881fe8e42b2b901e23fe6adbb1c Mon Sep 17 00:00:00 2001 From: Christoph Hertzberg Date: Fri, 12 Aug 2016 15:15:34 +0200 Subject: bug #1272: Disable assertion when total number of columns is zero. Also moved assertion to finished() method and adapted unit-test --- Eigen/src/Core/CommaInitializer.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'Eigen/src/Core/CommaInitializer.h') diff --git a/Eigen/src/Core/CommaInitializer.h b/Eigen/src/Core/CommaInitializer.h index b39a661d0..d218e9814 100644 --- a/Eigen/src/Core/CommaInitializer.h +++ b/Eigen/src/Core/CommaInitializer.h @@ -103,9 +103,7 @@ struct CommaInitializer EIGEN_EXCEPTION_SPEC(Eigen::eigen_assert_exception) #endif { - eigen_assert((m_row+m_currentBlockRows) == m_xpr.rows() - && m_col == m_xpr.cols() - && "Too few coefficients passed to comma initializer (operator<<)"); + finished(); } /** \returns the built matrix once all its coefficients have been set. @@ -116,7 +114,12 @@ struct CommaInitializer * \endcode */ EIGEN_DEVICE_FUNC - inline XprType& finished() { return m_xpr; } + inline XprType& finished() { + eigen_assert(((m_row+m_currentBlockRows) == m_xpr.rows() || m_xpr.cols() == 0) + && m_col == m_xpr.cols() + && "Too few coefficients passed to comma initializer (operator<<)"); + return m_xpr; + } XprType& m_xpr; // target expression Index m_row; // current row id -- cgit v1.2.3