Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r55736 - in trunk/boost/archive: . detail impl
From: ramey_at_[hidden]
Date: 2009-08-23 15:25:27


Author: ramey
Date: 2009-08-23 15:25:26 EDT (Sun, 23 Aug 2009)
New Revision: 55736
URL: http://svn.boost.org/trac/boost/changeset/55736

Log:
Improved implemenation of boost_serializer_map
Improved support for serialization of types in DLLS
New exception for violations of ODR when using DLLS
Fix error in recent update of export.hpp
Text files modified:
   trunk/boost/archive/archive_exception.hpp | 70 +++++++++++++++++++++--------
   trunk/boost/archive/detail/archive_serializer_map.hpp | 2
   trunk/boost/archive/detail/basic_serializer.hpp | 20 ++++---
   trunk/boost/archive/detail/basic_serializer_map.hpp | 12 +++-
   trunk/boost/archive/detail/iserializer.hpp | 77 +++++++++++++++++---------------
   trunk/boost/archive/detail/oserializer.hpp | 95 ++++++++++++++++++---------------------
   trunk/boost/archive/impl/archive_serializer_map.ipp | 2
   trunk/boost/archive/impl/basic_binary_iprimitive.ipp | 25 ++++++++--
   trunk/boost/archive/shared_ptr_helper.hpp | 38 ++++++++++++---
   trunk/boost/archive/text_iarchive.hpp | 10 ++-
   trunk/boost/archive/text_oarchive.hpp | 5 +
   11 files changed, 217 insertions(+), 139 deletions(-)

Modified: trunk/boost/archive/archive_exception.hpp
==============================================================================
--- trunk/boost/archive/archive_exception.hpp (original)
+++ trunk/boost/archive/archive_exception.hpp 2009-08-23 15:25:26 EDT (Sun, 23 Aug 2009)
@@ -18,6 +18,7 @@
 
 #include <exception>
 #include <cassert>
+#include <string>
 
 namespace boost {
 namespace archive {
@@ -55,64 +56,93 @@
         unsupported_class_version, // type saved with a version # greater than the
                             // one used by the program. This indicates that the proggram
                             // needs to be rebuilt.
- inconsistent_pointer_serialization // an object as been serialized
+ inconsistent_pointer_serialization, // an object as been serialized
                             // more than once through pointers of different types.
+ multiple_code_instantiation // code for implementing serialization for some
+ // type has been instantiated in more than one module.
     } exception_code;
+private:
+ std::string m_msg;
+public:
     exception_code code;
- archive_exception(exception_code c) :
+ archive_exception(
+ exception_code c,
+ const char * e1 = NULL,
+ const char * e2 = NULL
+ ) :
         code(c)
- {}
- virtual const char *what( ) const throw( )
     {
- const char *msg = "programming error";
+ m_msg = "programming error";
         switch(code){
         case no_exception:
- msg = "uninitialized exception";
+ m_msg = "uninitialized exception";
             break;
         case unregistered_class:
- msg = "unregistered class";
+ m_msg = "unregistered class";
+ if(NULL != e1){
+ m_msg += " - ";
+ m_msg += e1;
+ }
             break;
         case invalid_signature:
- msg = "invalid signature";
+ m_msg = "invalid signature";
             break;
         case unsupported_version:
- msg = "unsupported version";
+ m_msg = "unsupported version";
             break;
         case pointer_conflict:
- msg = "pointer conflict";
+ m_msg = "pointer conflict";
             break;
         case incompatible_native_format:
- msg = "incompatible native format";
+ m_msg = "incompatible native format";
+ if(NULL != e1){
+ m_msg += " - ";
+ m_msg += e1;
+ }
             break;
         case array_size_too_short:
- msg = "array size too short";
+ m_msg = "array size too short";
             break;
         case stream_error:
- msg = "stream error";
+ m_msg = "stream error";
             break;
         case invalid_class_name:
- msg = "class name too long";
+ m_msg = "class name too long";
             break;
         case unregistered_cast:
- msg = "unregistered void cast";
- break;
+ m_msg = "unregistered void cast ";
+ m_msg += (NULL != e1) ? e1 : "?";
+ m_msg += "<-";
+ m_msg += (NULL != e2) ? e2 : "?";
+ break;
         case unsupported_class_version:
- msg = "class version";
+ m_msg = "class version";
             break;
         case other_exception:
             // if get here - it indicates a derived exception
             // was sliced by passing by value in catch
- msg = "unknown derived exception";
+ m_msg = "unknown derived exception";
             break;
         case inconsistent_pointer_serialization:
             // same object saved through different kinds of pointers
- msg = "inconsistent_pointer_serialization";
+ m_msg = "inconsistent_pointer_serialization";
+ break;
+ case multiple_code_instantiation:
+ m_msg = "code instantiated in more than one module";
+ if(NULL != e1){
+ m_msg += " - ";
+ m_msg += e1;
+ }
             break;
         default:
             assert(false);
             break;
         }
- return msg;
+ }
+ ~archive_exception() throw () {}
+ virtual const char *what( ) const throw()
+ {
+ return m_msg.c_str();
     }
 protected:
     archive_exception() :

Modified: trunk/boost/archive/detail/archive_serializer_map.hpp
==============================================================================
--- trunk/boost/archive/detail/archive_serializer_map.hpp (original)
+++ trunk/boost/archive/detail/archive_serializer_map.hpp 2009-08-23 15:25:26 EDT (Sun, 23 Aug 2009)
@@ -39,7 +39,7 @@
 class BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) archive_serializer_map
 {
 public:
- static void insert(const basic_serializer * bs);
+ static bool insert(const basic_serializer * bs);
     static void erase(const basic_serializer * bs);
     static const basic_serializer * find(
         const boost::serialization::extended_type_info & type_

Modified: trunk/boost/archive/detail/basic_serializer.hpp
==============================================================================
--- trunk/boost/archive/detail/basic_serializer.hpp (original)
+++ trunk/boost/archive/detail/basic_serializer.hpp 2009-08-23 15:25:26 EDT (Sun, 23 Aug 2009)
@@ -40,20 +40,22 @@
         assert(NULL != & eti);
     }
 public:
+ inline bool
+ operator<(const basic_serializer & rhs) const {
+ // can't compare address since there can be multiple eti records
+ // for the same type in different execution modules (that is, DLLS)
+ // leave this here as a reminder not to do this!
+ // return & lhs.get_eti() < & rhs.get_eti();
+ return get_eti() < rhs.get_eti();
+ }
+ const char * get_debug_info() const {
+ return m_eti->get_debug_info();
+ }
     const boost::serialization::extended_type_info & get_eti() const {
         return * m_eti;
     }
 };
 
-inline bool
-operator<(const basic_serializer & lhs, const basic_serializer & rhs) {
- // can't compare address since there can be multiple eti records
- // for the same type in different execution modules (that is, DLLS)
- // leave this here as a reminder not to do this!
- // return & lhs.get_eti() < & rhs.get_eti();
- return lhs.get_eti() < rhs.get_eti();
-}
-
 class basic_serializer_arg : public basic_serializer {
 public:
     basic_serializer_arg(const serialization::extended_type_info & eti) :

Modified: trunk/boost/archive/detail/basic_serializer_map.hpp
==============================================================================
--- trunk/boost/archive/detail/basic_serializer_map.hpp (original)
+++ trunk/boost/archive/detail/basic_serializer_map.hpp 2009-08-23 15:25:26 EDT (Sun, 23 Aug 2009)
@@ -16,7 +16,7 @@
 
 // See http://www.boost.org for updates, documentation, and revision history.
 
-#include <list>
+#include <set>
 
 #include <boost/config.hpp>
 #include <boost/archive/detail/auto_link_archive.hpp>
@@ -37,10 +37,16 @@
 class BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) basic_serializer_map : public
     boost::noncopyable
 {
- typedef std::list<const basic_serializer *> map_type;
+ struct type_info_pointer_compare
+ {
+ bool operator()(
+ const basic_serializer * lhs, const basic_serializer * rhs
+ ) const ;
+ };
+ typedef std::set<const basic_serializer *, type_info_pointer_compare> map_type;
     map_type m_map;
 public:
- void insert(const basic_serializer * bs);
+ bool insert(const basic_serializer * bs);
     void erase(const basic_serializer * bs);
     const basic_serializer * find(
         const boost::serialization::extended_type_info & type_

Modified: trunk/boost/archive/detail/iserializer.hpp
==============================================================================
--- trunk/boost/archive/detail/iserializer.hpp (original)
+++ trunk/boost/archive/detail/iserializer.hpp 2009-08-23 15:25:26 EDT (Sun, 23 Aug 2009)
@@ -33,6 +33,16 @@
     using ::size_t;
 } // namespace std
 #endif
+
+#include <boost/mpl/eval_if.hpp>
+#include <boost/mpl/identity.hpp>
+#include <boost/mpl/greater_equal.hpp>
+#include <boost/mpl/equal_to.hpp>
+#include <boost/mpl/bool.hpp>
+
+#ifndef BOOST_SERIALIZATION_DEFAULT_TYPE_INFO
+ #include <boost/serialization/extended_type_info_typeid.hpp>
+#endif
 #include <boost/serialization/throw_exception.hpp>
 #include <boost/serialization/smart_cast.hpp>
 #include <boost/static_assert.hpp>
@@ -58,30 +68,6 @@
 #include <boost/type_traits/has_new_operator.hpp>
 #endif
 
-#include <boost/mpl/eval_if.hpp>
-#include <boost/mpl/if.hpp>
-#include <boost/mpl/identity.hpp>
-#include <boost/mpl/or.hpp>
-#include <boost/mpl/and.hpp>
-#include <boost/mpl/less.hpp>
-#include <boost/mpl/greater_equal.hpp>
-#include <boost/mpl/equal_to.hpp>
-#include <boost/mpl/int.hpp>
-#include <boost/mpl/list.hpp>
-#include <boost/mpl/empty.hpp>
-#include <boost/mpl/not.hpp>
-#include <boost/mpl/bool.hpp>
-
-#ifndef BOOST_SERIALIZATION_DEFAULT_TYPE_INFO
- #include <boost/serialization/extended_type_info_typeid.hpp>
-#endif
-// the following is need only for dynamic cast of polymorphic pointers
-#include <boost/archive/detail/basic_iarchive.hpp>
-#include <boost/archive/detail/basic_iserializer.hpp>
-#include <boost/archive/detail/basic_pointer_iserializer.hpp>
-#include <boost/archive/detail/archive_serializer_map.hpp>
-#include <boost/archive/archive_exception.hpp>
-
 #include <boost/serialization/serialization.hpp>
 #include <boost/serialization/version.hpp>
 #include <boost/serialization/level.hpp>
@@ -93,6 +79,14 @@
 #include <boost/serialization/collection_size_type.hpp>
 #include <boost/serialization/singleton.hpp>
 
+// the following is need only for dynamic cast of polymorphic pointers
+#include <boost/archive/archive_exception.hpp>
+#include <boost/archive/detail/basic_iarchive.hpp>
+#include <boost/archive/detail/basic_iserializer.hpp>
+#include <boost/archive/detail/basic_pointer_iserializer.hpp>
+#include <boost/archive/detail/archive_serializer_map.hpp>
+#include <boost/archive/detail/check.hpp>
+
 namespace boost {
 
 namespace serialization {
@@ -124,8 +118,10 @@
     // protected constructor since it's always created by singleton
     explicit iserializer() :
         basic_iserializer(
- boost::serialization::type_info_implementation<T>::type
- ::get_const_instance()
+ boost::serialization::singleton<
+ BOOST_DEDUCED_TYPENAME
+ boost::serialization::type_info_implementation<T>::type
+ >::get_const_instance()
         )
     {}
 public:
@@ -162,9 +158,12 @@
 ) const {
     // trap case where the program cannot handle the current version
     if(file_version > version())
- boost::serialization::throw_exception(archive::archive_exception(
- boost::archive::archive_exception::unsupported_class_version
- ));
+ boost::serialization::throw_exception(
+ archive::archive_exception(
+ boost::archive::archive_exception::unsupported_class_version,
+ get_debug_info()
+ )
+ );
 
     // make sure call is routed through the higest interface that might
     // be specialized by the user.
@@ -309,8 +308,10 @@
 template<class Archive, class T>
 pointer_iserializer<Archive, T>::pointer_iserializer() :
     basic_pointer_iserializer(
- boost::serialization::type_info_implementation<T>::type
- ::get_const_instance()
+ boost::serialization::singleton<
+ BOOST_DEDUCED_TYPENAME
+ boost::serialization::type_info_implementation<T>::type
+ >::get_const_instance()
     )
 {
     boost::serialization::singleton<
@@ -464,8 +465,10 @@
         return static_cast<T *>(
             boost::serialization::void_upcast(
                 eti,
- boost::serialization::type_info_implementation<T>::type
- ::get_const_instance(),
+ boost::serialization::singleton<
+ BOOST_DEDUCED_TYPENAME
+ boost::serialization::type_info_implementation<T>::type
+ >::get_const_instance(),
                 t
             )
         );
@@ -510,9 +513,11 @@
         boost::serialization::collection_size_type count;
         ar >> BOOST_SERIALIZATION_NVP(count);
         if(static_cast<std::size_t>(count) > current_count)
- boost::serialization::throw_exception(archive::archive_exception(
- boost::archive::archive_exception::array_size_too_short
- ));
+ boost::serialization::throw_exception(
+ archive::archive_exception(
+ boost::archive::archive_exception::array_size_too_short
+ )
+ );
         ar >> serialization::make_array(static_cast<value_type*>(&t[0]),count);
     }
 };

Modified: trunk/boost/archive/detail/oserializer.hpp
==============================================================================
--- trunk/boost/archive/detail/oserializer.hpp (original)
+++ trunk/boost/archive/detail/oserializer.hpp 2009-08-23 15:25:26 EDT (Sun, 23 Aug 2009)
@@ -26,38 +26,27 @@
 #include <cstddef> // NULL
 
 #include <boost/config.hpp>
-#include <boost/detail/workaround.hpp>
-#include <boost/serialization/throw_exception.hpp>
-#include <boost/serialization/smart_cast.hpp>
 #include <boost/static_assert.hpp>
-#include <boost/serialization/static_warning.hpp>
-
-#include <boost/type_traits/is_pointer.hpp>
-#include <boost/type_traits/is_enum.hpp>
-#include <boost/type_traits/is_const.hpp>
-#include <boost/type_traits/is_polymorphic.hpp>
-#include <boost/type_traits/remove_extent.hpp>
-#include <boost/serialization/assume_abstract.hpp>
+#include <boost/detail/workaround.hpp>
 
 #include <boost/mpl/eval_if.hpp>
-#include <boost/mpl/and.hpp>
-#include <boost/mpl/or.hpp>
-#include <boost/mpl/greater_equal.hpp>
 #include <boost/mpl/equal_to.hpp>
-#include <boost/mpl/int.hpp>
+#include <boost/mpl/greater_equal.hpp>
 #include <boost/mpl/identity.hpp>
-#include <boost/mpl/not.hpp>
 
 #ifndef BOOST_SERIALIZATION_DEFAULT_TYPE_INFO
     #include <boost/serialization/extended_type_info_typeid.hpp>
 #endif
+#include <boost/serialization/throw_exception.hpp>
+#include <boost/serialization/smart_cast.hpp>
+#include <boost/serialization/assume_abstract.hpp>
+#include <boost/serialization/static_warning.hpp>
 
-// the following is need only for dynamic cast of polymorphic pointers
-#include <boost/archive/detail/basic_oarchive.hpp>
-#include <boost/archive/detail/basic_oserializer.hpp>
-#include <boost/archive/detail/basic_pointer_oserializer.hpp>
-#include <boost/archive/detail/archive_serializer_map.hpp>
-#include <boost/archive/archive_exception.hpp>
+#include <boost/type_traits/is_pointer.hpp>
+#include <boost/type_traits/is_enum.hpp>
+#include <boost/type_traits/is_const.hpp>
+#include <boost/type_traits/is_polymorphic.hpp>
+#include <boost/type_traits/remove_extent.hpp>
 
 #include <boost/serialization/serialization.hpp>
 #include <boost/serialization/version.hpp>
@@ -70,6 +59,13 @@
 #include <boost/serialization/collection_size_type.hpp>
 #include <boost/serialization/singleton.hpp>
 
+// the following is need only for dynamic cast of polymorphic pointers
+#include <boost/archive/archive_exception.hpp>
+#include <boost/archive/detail/basic_oarchive.hpp>
+#include <boost/archive/detail/basic_oserializer.hpp>
+#include <boost/archive/detail/basic_pointer_oserializer.hpp>
+#include <boost/archive/detail/archive_serializer_map.hpp>
+
 namespace boost {
 
 namespace serialization {
@@ -104,8 +100,10 @@
 public:
     explicit BOOST_DLLEXPORT oserializer() :
         basic_oserializer(
- boost::serialization::type_info_implementation<T>::type
- ::get_const_instance()
+ boost::serialization::singleton<
+ BOOST_DEDUCED_TYPENAME
+ boost::serialization::type_info_implementation<T>::type
+ >::get_const_instance()
         )
     {}
     virtual BOOST_DLLEXPORT void save_object_data(
@@ -188,8 +186,10 @@
 template<class Archive, class T>
 pointer_oserializer<Archive, T>::pointer_oserializer() :
     basic_pointer_oserializer(
- boost::serialization::type_info_implementation<T>::type
- ::get_const_instance()
+ boost::serialization::singleton<
+ BOOST_DEDUCED_TYPENAME
+ boost::serialization::type_info_implementation<T>::type
+ >::get_const_instance()
     )
 {
     // make sure appropriate member function is instantiated
@@ -356,8 +356,10 @@
         ){
             BOOST_DEDUCED_TYPENAME
             boost::serialization::type_info_implementation<T>::type const
- & i = boost::serialization::type_info_implementation<T>::type
- ::get_const_instance();
+ & i = boost::serialization::singleton<
+ BOOST_DEDUCED_TYPENAME
+ boost::serialization::type_info_implementation<T>::type
+ >::get_const_instance();
 
             boost::serialization::extended_type_info const * const this_type = & i;
 
@@ -372,7 +374,10 @@
             // is either registered or exported.
             if(NULL == true_type){
                 boost::serialization::throw_exception(
- archive_exception(archive_exception::unregistered_class)
+ archive_exception(
+ archive_exception::unregistered_class,
+ true_type->get_debug_info()
+ )
                 );
             }
 
@@ -392,7 +397,11 @@
             );
             if(NULL == vp){
                 boost::serialization::throw_exception(
- archive_exception(archive_exception::unregistered_cast)
+ archive_exception(
+ archive_exception::unregistered_cast,
+ true_type->get_debug_info(),
+ this_type->get_debug_info()
+ )
                 );
             }
 
@@ -408,7 +417,10 @@
             assert(NULL != bpos);
             if(NULL == bpos)
                 boost::serialization::throw_exception(
- archive_exception(archive_exception::unregistered_class)
+ archive_exception(
+ archive_exception::unregistered_class,
+ bpos->get_debug_info()
+ )
                 );
             ar.save_pointer(vp, bpos);
         }
@@ -424,24 +436,6 @@
>::type type;
     };
 
- template<class T>
- struct warning_check {
- typedef
- BOOST_DEDUCED_TYPENAME mpl::or_<
- BOOST_DEDUCED_TYPENAME mpl::greater<
- serialization::implementation_level<T>,
- mpl::int_<serialization::object_serializable>
- >,
- BOOST_DEDUCED_TYPENAME mpl::not_<
- BOOST_DEDUCED_TYPENAME mpl::equal_to<
- serialization::tracking_level<T>,
- mpl::int_<serialization::track_selectively>
- >
- >
- > type;
- BOOST_STATIC_CONSTANT(bool, value = type::value);
- };
-
     // used to convert TPtr in to a pointer to a T
     template<class T>
     static void save(
@@ -465,7 +459,7 @@
         // The reason that this is permited it all is that it is results
         // in more efficient code. But it comes with it's own risk.
 
- BOOST_STATIC_WARNING(warning_check<T>::value);
+// BOOST_STATIC_WARNING(warning_check<T>::value);
         conditional<T>::type::save(ar, const_cast<T &>(t));
     }
 
@@ -568,6 +562,7 @@
     BOOST_STATIC_WARNING(check_tracking<T>::value);
         save(ar, const_cast<const T &>(t));
 }
+
 #endif
 
 } // namespace archive

Modified: trunk/boost/archive/impl/archive_serializer_map.ipp
==============================================================================
--- trunk/boost/archive/impl/archive_serializer_map.ipp (original)
+++ trunk/boost/archive/impl/archive_serializer_map.ipp 2009-08-23 15:25:26 EDT (Sun, 23 Aug 2009)
@@ -28,7 +28,7 @@
 }
 
 template<class Archive>
-BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
+BOOST_ARCHIVE_OR_WARCHIVE_DECL(bool)
 archive_serializer_map<Archive>::insert(const basic_serializer * bs){
     return boost::serialization::singleton<
         map<Archive>

Modified: trunk/boost/archive/impl/basic_binary_iprimitive.ipp
==============================================================================
--- trunk/boost/archive/impl/basic_binary_iprimitive.ipp (original)
+++ trunk/boost/archive/impl/basic_binary_iprimitive.ipp 2009-08-23 15:25:26 EDT (Sun, 23 Aug 2009)
@@ -46,22 +46,34 @@
     this->This()->load(size);
     if(sizeof(int) != size)
         boost::serialization::throw_exception(
- archive_exception(archive_exception::incompatible_native_format)
+ archive_exception(
+ archive_exception::incompatible_native_format,
+ "size of int"
+ )
         );
     this->This()->load(size);
     if(sizeof(long) != size)
         boost::serialization::throw_exception(
- archive_exception(archive_exception::incompatible_native_format)
+ archive_exception(
+ archive_exception::incompatible_native_format,
+ "size of long"
+ )
         );
     this->This()->load(size);
     if(sizeof(float) != size)
         boost::serialization::throw_exception(
- archive_exception(archive_exception::incompatible_native_format)
+ archive_exception(
+ archive_exception::incompatible_native_format,
+ "size of float"
+ )
         );
     this->This()->load(size);
     if(sizeof(double) != size)
         boost::serialization::throw_exception(
- archive_exception(archive_exception::incompatible_native_format)
+ archive_exception(
+ archive_exception::incompatible_native_format,
+ "size of double"
+ )
         );
 
     // for checking endian
@@ -69,7 +81,10 @@
     this->This()->load(i);
     if(1 != i)
         boost::serialization::throw_exception(
- archive_exception(archive_exception::incompatible_native_format)
+ archive_exception(
+ archive_exception::incompatible_native_format,
+ "endian setting"
+ )
         );
 }
 

Modified: trunk/boost/archive/shared_ptr_helper.hpp
==============================================================================
--- trunk/boost/archive/shared_ptr_helper.hpp (original)
+++ trunk/boost/archive/shared_ptr_helper.hpp 2009-08-23 15:25:26 EDT (Sun, 23 Aug 2009)
@@ -98,20 +98,25 @@
             s.reset();
             return;
         }
+ const boost::serialization::extended_type_info * this_type
+ = & boost::serialization::type_info_implementation<T>::type
+ ::get_const_instance();
         // get pointer to the most derived object. This is effectively
         // the object identifer
         const boost::serialization::extended_type_info * true_type
- = boost::serialization::type_info_implementation<T>::type
- ::get_const_instance().get_derived_extended_type_info(*t);
+ = boost::serialization::singleton<
+ BOOST_DEDUCED_TYPENAME
+ boost::serialization::type_info_implementation<T>::type
+ >::get_const_instance().get_derived_extended_type_info(*t);
         // note:if this exception is thrown, be sure that derived pointer
         // is either registered or exported.
         if(NULL == true_type)
             boost::serialization::throw_exception(
- archive_exception(archive_exception::unregistered_class)
+ archive_exception(
+ archive_exception::unregistered_class,
+ this_type->get_debug_info()
+ )
             );
- const boost::serialization::extended_type_info * this_type
- = & boost::serialization::type_info_implementation<T>::type
- ::get_const_instance();
 
         // get void pointer to the most derived type
         // this uniquely identifies the object referred to
@@ -120,6 +125,14 @@
             *this_type,
             static_cast<const void *>(t)
         );
+ if(NULL == od)
+ boost::serialization::throw_exception(
+ archive_exception(
+ archive_exception::unregistered_cast,
+ true_type->get_debug_info(),
+ this_type->get_debug_info()
+ )
+ );
 
         // make tracking array if necessary
         if(NULL == m_pointers)
@@ -134,11 +147,20 @@
             m_pointers->insert(collection_type::value_type(od, sp));
             return;
         }
- t = static_cast<T *>(const_cast<void *>(void_upcast(
+ od = void_upcast(
             *true_type,
             *this_type,
             ((*it).second.get())
- )));
+ );
+ if(NULL == od)
+ boost::serialization::throw_exception(
+ archive_exception(
+ archive_exception::unregistered_cast,
+ true_type->get_debug_info(),
+ this_type->get_debug_info()
+ )
+ );
+ t = static_cast<T *>(const_cast<void *>(od));
         s = shared_ptr<T>((*it).second, t); // aliasing
     }
 // #ifdef BOOST_SERIALIZATION_SHARED_PTR_132_HPP

Modified: trunk/boost/archive/text_iarchive.hpp
==============================================================================
--- trunk/boost/archive/text_iarchive.hpp (original)
+++ trunk/boost/archive/text_iarchive.hpp 2009-08-23 15:25:26 EDT (Sun, 23 Aug 2009)
@@ -84,8 +84,9 @@
     public text_iarchive_impl<naked_text_iarchive>
 {
 public:
- naked_text_iarchive(std::istream & is, unsigned int flags = 0) :
- text_iarchive_impl<naked_text_iarchive>(is, flags)
+ naked_text_iarchive(std::istream & is_, unsigned int flags = 0) :
+ // note: added _ to suppress useless gcc warning
+ text_iarchive_impl<naked_text_iarchive>(is_, flags)
     {}
     ~naked_text_iarchive(){}
 };
@@ -107,8 +108,9 @@
     public detail::shared_ptr_helper
 {
 public:
- text_iarchive(std::istream & is, unsigned int flags = 0) :
- text_iarchive_impl<text_iarchive>(is, flags)
+ text_iarchive(std::istream & is_, unsigned int flags = 0) :
+ // note: added _ to suppress useless gcc warning
+ text_iarchive_impl<text_iarchive>(is_, flags)
     {}
     ~text_iarchive(){}
 };

Modified: trunk/boost/archive/text_oarchive.hpp
==============================================================================
--- trunk/boost/archive/text_oarchive.hpp (original)
+++ trunk/boost/archive/text_oarchive.hpp 2009-08-23 15:25:26 EDT (Sun, 23 Aug 2009)
@@ -83,8 +83,9 @@
 {
 public:
      
- text_oarchive(std::ostream & os, unsigned int flags = 0) :
- text_oarchive_impl<text_oarchive>(os, flags)
+ text_oarchive(std::ostream & os_, unsigned int flags = 0) :
+ // note: added _ to suppress useless gcc warning
+ text_oarchive_impl<text_oarchive>(os_, flags)
     {}
     ~text_oarchive(){}
 };


Boost-Commit 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