Boost logo

Boost :

Subject: [boost] [Serialization] assertion failure on exit
From: Kenny Riddile (kfriddile_at_[hidden])
Date: 2008-12-08 14:52:35


I'm getting the following assertion failure on exit when instantiating
certain serializable classes:

Assertion failed: NULL != l, file
libs\serialization\src\extended_type_info.cpp, line 47

I was finally able to determine a difference between the classes that
caused the assertion failure and those that didn't. Here's some code:

//////////////////////////////////////////////////////////////////
// Serializable.hpp:

class Serializable
{
public:
   virtual ~Serializable() = 0;

   template< typename Archive >
   void serialize( Archive& /*ar*/, const unsigned int /*version*/ )
   {
   }

private:
};

inline Serializable::~Serializable()
{
}

BOOST_CLASS_EXPORT( Serializable )
//////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////
// Foo.hpp:
struct Foo : Serializable
{
   template< typename Archive >
   void serialize( Archive& ar, const unsigned int /*version*/ )
   {
     ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( Serializable );
   }
};

BOOST_CLASS_EXPORT( Foo )
//////////////////////////////////////////////////////////////////

The above code does not assert on exit after instantiating a Foo object.
  However, if I make Foo not header-only like so:

//////////////////////////////////////////////////////////////////
// Foo.hpp:
struct Foo : Serializable
{
   Foo();

   template< typename Archive >
   void serialize( Archive& ar, const unsigned int /*version*/ )
   {
     ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( Serializable );
   }
};

BOOST_CLASS_EXPORT( Foo )
//////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////
// Foo.cpp:
Foo::Foo()
{

}
//////////////////////////////////////////////////////////////////

then I get the assertion failure on program exit if I so much as
instantiate a Foo object.


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