Boost logo

Boost Users :

Subject: Re: [Boost-users] [Serialization] Strange giant warning
From: Robert Ramey (ramey_at_[hidden])
Date: 2010-03-10 23:31:08


OvermindDL1 wrote:
> On Tue, Mar 9, 2010 at 6:38 AM, Avi Bahra <avibahra_at_[hidden]>
> wrote:
>> This is caused by a bug in the boost serialisation, well at least in
>> 1.39 Where is assumes that shared ptr must be polymorphic
>> I have already reported a similar problem.
>> i.e
>
> Oh I *SO* hate that bug, so very much.

what makes you think it's a bug in serialization library?

If I recall correctly, the motivation for the warning is
the following.

class base { // no virtual functions here !!
    ...
};

class derived : public base {
    ...
};

BOOST_CLASS_EXPORT(derived);

...

base * b = new derived;
ar << b; // b will be "sliced" - only the base class part will be
serialized !!!

In this case the user is almost certainly making a mistake which will be
exceeding difficult to find. What's more, he well probably have to send
inumermable emails to this list alleging that the serialization library has
a bug and I will have do debug his program for him.. If you want
to get ride of the warning, either make the base class virtual or
use

derived *d = new derived;
ar << d;

I'm speaking from memory and it's possible that the situation
has changed since 1.39 and the message is now spurious. If so
send a small test case which shows that the library has a bug.

Robert Ramey


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net