New user self-registration is currently disabled. Please email eigen-core-team @ lists.tuxfamily.org if you need an account.
Bug 1242 - Comma initializer error for matrix with 0 rows
Comma initializer error for matrix with 0 rows
Status: RESOLVED FIXED
Product: Eigen
Classification: Unclassified
Component: Core - general
3.2
x86 - 64-bit Linux
: Normal Crash
Assigned To: Nobody
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2016-06-22 08:39 UTC by Mikhail Katliar
Modified: 2016-06-23 08:27 UTC (History)
3 users (show)



Attachments

Description Mikhail Katliar 2016-06-22 08:39:48 UTC
Example:

```
#include <Eigen/Dense>

void test()
{
        auto const M = 0;   // If changed to M = 1, works fine
	auto const N1 = 2;
	auto const N2 = 1;

	Eigen::Matrix<double, M, N1> A1;
	Eigen::Matrix<double, M, N2> A2;
	Eigen::Matrix<double, M, N1 + N2> B;

	B << A1, A2;
}
```

Produces the following error at runtime:

```
/usr/local/include/eigen3/Eigen/src/Core/CommaInitializer.h:114: Eigen::CommaInitializer<MatrixType>::~CommaInitializer() [with XprType = Eigen::Matrix<double, 0, 3>]: Assertion `(m_row+m_currentBlockRows) == m_xpr.rows() && m_col == m_xpr.cols() && "Too few coefficients passed to comma initializer (operator<<)"' failed.
```
Comment 1 Gael Guennebaud 2016-06-23 08:27:19 UTC
ouch, that's a truly nasty corner case!

Fixed:
default: https://bitbucket.org/eigen/eigen/commits/30293148a638/
3.2:     https://bitbucket.org/eigen/eigen/commits/44abf0a7b16a/

Note You need to log in before you can comment on or make changes to this bug.