[Bug c++/44827] g++4.3.4 segfaults when using boost::intrusive::list

redi at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Mon Jul 5 23:26:00 GMT 2010



------- Comment #2 from redi at gcc dot gnu dot org  2010-07-05 23:26 -------
unpreprocessed source (because preprocessed boost source is so dependent on
compiler version it often won't compile with other versions)

#include <boost/intrusive/list.hpp>

struct A : public boost::intrusive::list_base_hook<> {
 virtual ~A() {}

};

template<class X>
struct D : A {
 X x;
 D(const X& x) : x(x) {}
};

typedef boost::intrusive::list<A> A_list;


struct data_holder {
 A_list a;

 template<class C>
 static void delete_disposer(C* c){
  delete c;
 }

 template<class X>
 D<X>* insert(const X& x){
  D<X> *t = new D<X>(x);
  a.push_back(*t);
  return t;
 }

 template<class X>
 void remove(D<X>* t){
  A_list::iterator it = A_list::s_iterator_to(*t);
  a.erase_and_dispose(it, delete_disposer<A>);
 }

};

int main() {

 data_holder data;

 D<int> *i = data.insert(10);
 data.remove(i);

 return 0;
}

This ICEs with Boost 1.39 or current Boost trunk, using any of 4.5.1, 4.6.0 or
Fedora 4.4.3


-- 

redi at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
      Known to fail|                            |4.4.4 4.5.1 4.6.0
   Last reconfirmed|0000-00-00 00:00:00         |2010-07-05 23:26:24
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44827



More information about the Gcc-bugs mailing list