From 87112908be917c37aa2c22bd238a43c60528ec5b Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Thu, 23 Jun 2016 10:25:04 +0200 Subject: [PATCH] Biug 1242: fix comma init with empty matrices. (grafted from a3f7edf7e7672094190e04a0b4417de1abfa3de5 ) --- Eigen/src/Core/CommaInitializer.h | 7 +++++-- test/commainitializer.cpp | 23 +++++++++++++++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/Eigen/src/Core/CommaInitializer.h b/Eigen/src/Core/CommaInitializer.h index a036d8c3b..73e2a6418 100644 --- a/Eigen/src/Core/CommaInitializer.h +++ b/Eigen/src/Core/CommaInitializer.h @@ -76,8 +76,11 @@ struct CommaInitializer template CommaInitializer& operator,(const DenseBase& other) { - if(other.cols()==0 || other.rows()==0) + if(other.rows()==0) + { + m_col += other.cols(); return *this; + } if (m_col==m_xpr.cols()) { m_row+=m_currentBlockRows; @@ -86,7 +89,7 @@ struct CommaInitializer eigen_assert(m_row+m_currentBlockRows<=m_xpr.rows() && "Too many rows passed to comma initializer (operator<<)"); } - eigen_assert(m_col A1; + Matrix A2; + Matrix B; + B << A1, A2; + } + { + Matrix A1; + Matrix A2; + Matrix B; + B << A1, + A2; + } + } + }