[Boost-bugs] [Boost C++ Libraries] #9716: iserializer calling next_object_pointer on base class pointer

Subject: [Boost-bugs] [Boost C++ Libraries] #9716: iserializer calling next_object_pointer on base class pointer
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-02-26 12:03:25


#9716: iserializer calling next_object_pointer on base class pointer
------------------------------+---------------------------
 Reporter: bremer@… | Owner: ramey
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: serialization
  Version: Boost 1.48.0 | Severity: Problem
 Keywords: |
------------------------------+---------------------------
 I wanted to modify the behaviour of our binary archive and therefore
 overloaded all functions from serialization::detail::basic_iarchive and
 basically copied all functions from basic_iarchive.cpp and called them.
 However the iarchive was not able to load pointers from an old archive
 properly, because in boost/archive/detail/iserializer.hpp the function is
 called on the base class pointer:


 It casts to the derived class:
 {{{
 template<class Archive, class T>
 BOOST_DLLEXPORT void pointer_iserializer<Archive, T>::load_object_ptr(
     basic_iarchive & ar,
     void * & x,
     const unsigned int file_version
 ) const
 {
     Archive & ar_impl =
         boost::serialization::smart_cast_reference<Archive &>(ar);
 }}}
 [...]
 However calls next_object_pointer on the base class:
 {{{
         // this addresses an obscure situtation that occurs when
         // load_constructor de-serializes something through a pointer.
         ar.next_object_pointer(t);
 }}}
 [...]
 And loads with the derived one:
 {{{
         boost::serialization::load_construct_data_adl<Archive, T>(
             ar_impl,
             t,
             file_version
         );
     }
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/9716>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:15 UTC