Re: [Boost-users] [Serialization] Strange giant warning
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
... boost_1_39_0/boost/ serialization/extended_type_info_typeid.hpp", line 88: warning #2414-D: delete of pointer to incomplete class BOOST_STATIC_WARNING(boost::is_polymorphic<T>::value); ^detected during: instantiation of "const boost::serialization::extended_type_info
*boost::serialization::extended_type_info_typeid<T>::get_derived_extended_type_info(const
T &) const [with T=Concrete]" at line 92 of
"/scratch/ma/emos/ma0/hpia64/boost/boost_1_39_0/boost/archive/shared_ptr_helper.hpp"
It looks like if we are serialising via a base ptr, and the base class is serialising concrete data member via a shared ptr, it has assumed that the type must be polymorphic. This does not seem right to me ?
The hacky way to stop your warning message would be add a dummy virtual function. Best regards, Ta, Avi
On Tue, Mar 9, 2010 at 6:38 AM, Avi Bahra
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.
On Tue, Mar 9, 2010 at 6:38 AM, Avi Bahra
It looks like if we are serialising via a base ptr, and the base class is serialising concrete data member via a shared ptr, it has assumed that the type must be polymorphic. This does not seem right to me ? The hacky way to stop your warning message would be add a dummy virtual function.
Which I had to do, which added a virtual table, which bloats the size of my small classes needlessly...
OvermindDL1 wrote:
On Tue, Mar 9, 2010 at 6:38 AM, Avi Bahra
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
On Wed, Mar 10, 2010 at 9:31 PM, Robert Ramey
OvermindDL1 wrote:
On Tue, Mar 9, 2010 at 6:38 AM, Avi Bahra
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
There is no hierarchy in my case, in fact it is just a struct with data members and shared_ptr's that link everything together, it does not compile, that is pretty irritating to have to create a freaking virtual function in a struct when it holds nothing but data.
Sorry for not replying sooner... I was distracted from my comp for a few days. I put that virtual destructor dummy into the problem classes and voila, my warnings are gone. Thanks alot. I can see the need for it now, and consider it good practice. I'm using boost 1.41 btw. Thanks again. Thanks so much!
OvermindDL1 wrote:
There is no hierarchy in my case, in fact it is just a struct with data members and shared_ptr's that link everything together, it does not compile, that is pretty irritating to have to create a freaking virtual function in a struct when it holds nothing but data.
Are you using BOOST_CLASS_EXPORT when it is in fact not necessary? Robert Ramey
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (4)
-
Avi Bahra
-
David
-
OvermindDL1
-
Robert Ramey