Dear all,

I found some weird error  in the  following code:

//////////////////////////////////////////////////////////////////////
#include <boost/numeric/ublas/io.hpp>
#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/vector.hpp>

using std::cout;
using std::endl;

int main()
{
    namespace ublas = boost::numeric::ublas;
    using namespace ublas;

    typedef ublas::vector<double> Vector;
    typedef ublas::matrix<double> Matrix;
    typedef ublas::zero_vector<double> ZeroVec;
    typedef ublas::zero_matrix<double> ZeroMat;
    typedef Vector::size_type size_type;   

    size_type N = 5;

    Matrix mat(ZeroMat(N, N));  // works fine
 
    Vector vec(ZeroVec(N));  // error incurred when compiled
    // Vector vec(ZeroVec(N +1 -1)); // works fine
    // Vector vec(ZeroVec(5)); // works fine

    // ZeroVec _v(N);   Vector vec(_v); // works fine

cout << "mat = " << mat << endl;  
cout << " vec = " << vec << endl;


    return 0;
}
///////////////////////////////////////////////////////////

The error message is:

warning: the address of `main()::Vector
   vec1(boost::numeric::ublas::zero_vector<double>)', will always be `true'
/tmp/cc2twKnI.o(.text+0x147): In function `main':
: undefined reference to `vec1(boost::numeric::ublas::zero_vector<double>)'
collect2: ld returned 1 exit status


So is it a bug over there? or something I haven't understood.

Thanks.
 
=======================
ZhiQiang Chen
Doctoral Student, VIS Lab, UCI
=======================