Compile error with boost 1.34

Bug #115150 reported by Keir Mierle
2
Affects Status Importance Assigned to Milestone
libmv
New
Undecided
Unassigned

Bug Description

When compiling with boost 1.34, I get the following error:
namespace ublas = boost::numeric::ublas;
using ublas::range;

typedef ublas::matrix<double> mat;
typedef ublas::vector<double> vec;

typedef ublas::matrix_range<mat> submat;
typedef ublas::vector_range<vec> subvec;
typedef ublas::matrix_vector_range<mat> submatvec;
typedef ublas::identity_matrix<double> eye;

vec sphere_to_disk(const vec &P)
{
 double norm = norm_2(P);
 int n = P.size();

 double fudge, nx, sign;
 if (P[n-1] < 0.0)
  sign = -1;
 else
  sign = 1;

 nx = 2*acos(sign*P[n-1]/norm);
 if (nx != 0.) {
  fudge = sign*nx/norm/sin(nx/2);
 } else {
  fudge = 0.0;
 }

 vec R(n-1);
 for (int i=0; i<n-1; i++)
  R[i] = fudge*P[i];

 assert(norm_2(R) < M_PI + 1e-10);

 return R; // ERROR HERE????
}

/* Generates the following incomprehensible error

scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
g++ -o src/mv.o -c -Wall -W -O0 -Werror -Iinclude -I/usr/local/include/boost-1_34 -Itest -Iextern/klt src/mv.cpp
g++ -o src/optimization.o -c -Wall -W -O0 -Werror -Iinclude -I/usr/local/include/boost-1_34 -Itest -Iextern/klt src/optimization.cpp
cc1plus: warnings being treated as errors
/usr/local/include/boost-1_34/boost/numeric/ublas/storage.hpp: In copy constructor 'boost::numeric::ublas::unbounded_array<T, ALLOC>::unbounded_array(const boost::numeric::ublas::unbounded_array<T, ALLOC>&) [with T = double, ALLOC = std::allocator<double>]':
/usr/local/include/boost-1_34/boost/numeric/ublas/vector.hpp:68: instantiated from 'boost::numeric::ublas::vector<T, A>::vector(const boost::numeric::ublas::vector<T, A>&) [with T = double, A = boost::numeric::ublas::unbounded_array<double, std::allocator<double> >]'
src/optimization.cpp:29: instantiated from here
/usr/local/include/boost-1_34/boost/numeric/ublas/storage.hpp:92: warning: base class 'class boost::numeric::ublas::storage_array<boost::numeric::ublas::unbounded_array<double, std::allocator<double> > >' should be explicitly initialized in the copy constructor
scons: *** [src/optimization.o] Error 1
scons: building terminated because of errors.

*/

Revision history for this message
Keir Mierle (mierle) wrote :

Fixed by patching storage.hpp in Boost 1.34. Not sure if this patch will cause problems.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.