Boost logo

Boost :

From: Boris Gubenko (Boris.Gubenko_at_[hidden])
Date: 2008-01-17 23:55:17


  x.cpp below reproduces failures of test_exported* tests on
  several platforms using gcc 4.1 and higher. The tests fail with:

terminate called after throwing an instance of
'boost::archive::archive_exception'
  what(): unregistered void cast

  When compiled with macro WORKS defined, i.e. when destructor of
  the base class is removed, reproducer succeeds. Does it give any
  clue?

  Thanks,
    Boris

x.cpp
-----
#include <fstream>
#include <boost/archive/binary_oarchive.hpp>

struct polymorphic_base
{
    template<class Archive>
    void serialize(Archive&, const unsigned int) {}
#ifndef WORKS
    virtual ~polymorphic_base(){}
#endif
};

struct polymorphic_derived : polymorphic_base
{
    template<class Archive>
    void serialize(Archive&, const unsigned int) {}
};

int main()
{
    std::ofstream os("x.x");
    boost::archive::binary_oarchive oa(os);
    polymorphic_base *rb = new polymorphic_derived;
    oa << BOOST_SERIALIZATION_NVP(rb);
}


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