Boost logo

Boost :

From: Ralf W. Grosse-Kunstleve (rwgk_at_[hidden])
Date: 2008-03-21 12:57:48


The shared_ptr (enable_shared_from_this) patch from yesterday breaks our
gcc 3.2 builds. Below is a fragment from a Boost.Python unit test (but not
requiring Python) and the error produced by gcc 3.2 (Redhat 8.0). gcc 3.2.3
(Redhat Workstation 3) has the same problem.
Is there a way to restore compatibility with the old gcc versions?
Thanks!
Ralf

% g++ -c -fno-strict-aliasing -fPIC -I/net/rosie/scratch1/rwgk/hot/boost ~/sp_err.cpp

/net/rosie/scratch1/rwgk/hot/boost/boost/shared_ptr.hpp: In function `D*
   boost::get_deleter(const boost::shared_ptr<Y>&) [with D =
   boost::detail::sp_deleter_wrapper, T = A]':
/net/rosie/scratch1/rwgk/hot/boost/boost/enable_shared_from_this.hpp:97: instantiated from `void boost::enable_shared_from_this<T>::_internal_accept_owner(boost::shared_ptr<Y>&) const [with U = A, T = A]'
/net/rosie/scratch1/rwgk/hot/boost/boost/shared_ptr.hpp:100: instantiated from `void boost::detail::sp_enable_shared_from_this(boost::shared_ptr<Y>*, const boost::enable_shared_from_this<T>*) [with T = A, Y = A]'
/net/rosie/scratch1/rwgk/hot/boost/boost/shared_ptr.hpp:181: instantiated from `boost::shared_ptr<T>::shared_ptr(Y*) [with Y = A, T = A]'
/net/cci/rwgk/sp_err.cpp:22: instantiated from here
/net/rosie/scratch1/rwgk/hot/boost/boost/shared_ptr.hpp:666: no matching
   function for call to `boost::detail::sp_deleter_wrapper::get_deleter()'

% cat ~/sp_err.cpp

#include <boost/enable_shared_from_this.hpp>
#include <boost/shared_ptr.hpp>

using namespace boost;

class A : public enable_shared_from_this<A> {
 public:
   A() : val(0) {};
   int val;
   typedef shared_ptr<A> A_ptr;
   A_ptr self() {
      A_ptr self;
      self = shared_from_this();
      return self;
    }

};

class B {
  public:
    B() {
       a = A::A_ptr(new A());
    }
    void set(A::A_ptr _a) {
      this->a = _a;
    }
    A::A_ptr get() {
       return a;
    }
    A::A_ptr a;
};


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk