[eigen] Matrix blocks not working with gcc 4.5.0

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


I've attached a simple test program which demonstrates the problem. It works fine in Visual Studio 2010, but gcc 4.5.0 chokes. For reference, the errors I'm seeing are:

testeigenblock.cpp: In member function ‘void S<N>::F()’:
testeigenblock.cpp:15:23: error: request for member ‘setIdentity’ in ‘(0, 0)’, which is of non-class type ‘int’ testeigenblock.cpp: In member function ‘void S<N>::F() [with int N = 4]’:
testeigenblock.cpp:23:9:   instantiated from here
testeigenblock.cpp:15:5: error: invalid operands of types ‘<unresolved overloaded function type>’ and ‘int’ to binary ‘operator<’ testeigenblock.cpp:16:5: error: invalid operands of types ‘<unresolved overloaded function type>’ and ‘int’ to binary ‘operator<’

Any idea how to fix this?
#include "Eigen/Core"

template <int N>
struct S
{
    Eigen::Matrix<double,2*N,2*N> m;

    void F();
};

template <int N>
void S<N>::F()
{
    m.block<N,N>(0,0).setIdentity();
    (m.block<N,N>(0,N)).setIdentity();
};

int main()
{
    S<4> s;

    s.F();
}


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