Boost logo

Boost-Build :

Subject: [Boost-build] Peculiar bug in Boost Serialization
From: Ven Tadipatri (ven.tadipatri_at_[hidden])
Date: 2011-01-20 16:42:45


Hi,
    I'm hoping someone on this list will be able to help with the
problem I'm having with boost serialization and virtual inheritance.
Below is the class that I'm working on.I followed the guide:
http://www.boost.org/doc/libs/1_45_0/libs/serialization/doc/index.html,
but the serialization methods don't seem to work for just this
particular class. A "pure virtual method called" error is thrown. There
are subclasses of ByteDataObject that have no problem, and other
subclasses of the BaseDataObject that also work just fine. It's just
this class, and I just can't seem to figure out what the error could be
due to.
    Other people seem to be having similar issues:
http://lists.boost.org/boost-users/2010/11/64147.php
I too feel that this is due to some upgrade in Boost that triggered the
error, since the last version I used: Boost 1.38 worked just fine with
this code. Also, commenting out the line makes the code work just fine.
Of course, that means calling the superclass's save and load methods,
which is precisely what the guide says not to do.

Here is the actual error:
pure virtual method called
terminate called without an active exception

However any attempt to debug it or output anything at that line fails,
which from what I understand may be due to some stack corruption or some
problem unrelated to the line of the code that actually seems to be failing.

Thanks,
Ven

class ByteDataObject : public virtual BaseDataObject {

   private:

       friend class boost::serialization::access;
       template <class Archive>
       void save (Archive & ar, const unsigned int version) const {

             // invoke base class serialization
           BaseDataObject::save(ar, version);
              //this fails
             //ar << boost::serialization::base_object<const
BaseDataObject>(*this);

       }

       template <class Archive>
       void load (Archive & ar, const unsigned int version) {

             // invoke base class serialization
           BaseDataObject::load(ar,version);
              //this fails
             //ar >>
boost::serialization::base_object<BaseDataObject>(*this);

       }

       BOOST_SERIALIZATION_SPLIT_MEMBER()
}


Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk