[eigen] Test for a non-compiling cast

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


Hi there,

I have problems with revision r900516 (I'm guessing since r900396).

I attach a test file.

--
ricard
http://www.ricardmarxer.com
http://www.caligraft.com
#include <Eigen/Core>
#include <cmath>

// import most common Eigen types 
USING_PART_OF_NAMESPACE_EIGEN

// Type for the Real values
typedef float Real;
typedef std::complex< Real > Complex;

// Normally used matrices
typedef Eigen::Matrix< Real, Eigen::Dynamic,Eigen::Dynamic > MatrixXR;
typedef Eigen::Matrix< Complex, Eigen::Dynamic,Eigen::Dynamic > MatrixXC;


// this compiles
void test_no_template(MatrixXR a, MatrixXC* b){
  (*b).block(0, 0, 3, 1) = a.block(0,0, 3, 1).cast<Complex>();
}

// this does not compile
template<class F>
void test_template(F a, MatrixXC* b){
  (*b).block(0, 0, 3, 1) = a.block(0,0, 3, 1).cast<Complex>();
}


int main(int, char *[])
{
  MatrixXR mr = MatrixXR::Zero(13, 10);
  MatrixXC mc = MatrixXC::Ones(13, 10);

  test_no_template(mr, &mc);
  test_template<MatrixXR>(mr, &mc);
  
  std::cout << "mc\n" << mc << std::endl;
}


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