I am using the Eigen template library for matrices. I am puzzled by compiler error in the Foo2
class while Foo1
(not templated) with almost the same code passes just fine:
#include<Eigen/Core>
struct Foo1{
static Eigen::Matrix<double,3,1> bar(const Eigen::Matrix<double,6,1>& v6){
return v6.head<3>();
}
};
template<typename Scalar>
struct Foo2{
static Eigen::Matrix<Scalar,3,1> bar(const Eigen::Matrix<Scalar,6,1>& v6){
return v6.head<3>();
}
};
gives (clang 3.4, gcc 4.8):
a.cc:8:53: error: expected expression
static Vec3 bar(const Vec6& v6){ return v6.head<3>(); }
^
1 error generated.
(does it mean the compiler parses the <
as "less than " instead of start of template arguments?).
Any clue as to what's going on?