Boost logo

Boost Users :

Subject: [Boost-users] [Serialization] assertion failure on exit
From: Kenny Riddile (kfriddile_at_[hidden])
Date: 2008-12-05 16:39:33


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.
  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-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net