Re: [eigen] Assigning a dynamic matrix to a fixed size matrix const reference causes invalid read

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


On 20.11.2013 18:10, Robert Johannes Langenberg wrote:
   Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic> dynMatr(2,2);

   //Should fail to compile because of type mismatch!
   const Eigen::Matrix<double,5,5,0,5,5>& refFixed=dynMatr;

That is valid C++: dynMatr is converted to a temporary Matrix<double,5,5>.
The size mismatch is caught at runtime, if you compile without -DNDEBUG.

Christoph

--
----------------------------------------------
Dipl.-Inf., Dipl.-Math. Christoph Hertzberg
Cartesium 0.049
Universität Bremen
Enrique-Schmidt-Straße 5
28359 Bremen

Tel: +49 (421) 218-64252
----------------------------------------------



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/