Boost logo

Boost :

Subject: [boost] [serialization] Warnings with MSVC 7.1
From: Chard (boost_at_[hidden])
Date: 2008-11-13 17:06:59


I've been working on a cut-over of a code-base from Boost 1.34.1 to 1.37 and
have found I now get a lot of compiler warnings in the serialization code.

The warnings (emitted via BOOST_STATIC_WARNING) appear to be where
non-polymorphic objects are serialized via shared_ptr. The boost
serialization code seems to want them to be polymorphic.

Are these benign warnings that can be disabled?

Apologies if this has been raised earlier; I had a good look..

The following example code triggers the warnings (MSVC 7.1):

======

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

using namespace boost;

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;
}


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