[Boost-bugs] [Boost C++ Libraries] #2508: Serialization emits lots of warnings for MSVC7.1 (non-polymorphic / shared_ptr)

Subject: [Boost-bugs] [Boost C++ Libraries] #2508: Serialization emits lots of warnings for MSVC7.1 (non-polymorphic / shared_ptr)
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2008-11-17 20:39:36


#2508: Serialization emits lots of warnings for MSVC7.1 (non-polymorphic /
shared_ptr)
---------------------+------------------------------------------------------
 Reporter: Chard | Type: Bugs
   Status: new | Milestone: Boost 1.38.0
Component: None | Version: Boost 1.36.0
 Severity: Problem | Keywords: non-polymorphic shared_ptr warnings MSVC 7.1
---------------------+------------------------------------------------------
 The serialization code emits many warnings if a non-polymorphic type is
 serialized via shared_ptr.

 The following code demonstrates the issue:

 {{{
 #include <boost/archive/text_iarchive.hpp>
 #include <boost/serialization/serialization.hpp>
 #include <boost/serialization/shared_ptr.hpp>
 #include <fstream>

 struct X
 {
     template <typename T>
     void serialize(T &ar, const unsigned int version)
     {}
 };
 typedef boost::shared_ptr<X> X_P;

 void
 test_ser()
 {
     X_P x_p;

     std::ifstream ifstr("test.txt");
     boost::archive::text_iarchive ar(ifstr);
     ar & x_p;
 }

 }}}

 Adding a virtual destructor to '''X''' causes the warnings to disappear,
 i.e. the serialization code ''wants'' the types to be polymorphic.

 This appears to be an issue when building with MSVC (though only tested
 with 7.1) because gcc 4.3.2 does not emit the warnings.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/2508>
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:49:59 UTC