
Kim Barrett wrote:
At 4:40 PM -0700 4/29/07, Jeff Garland wrote:
Domenico Andreoli wrote: diff -ur -x .svn ../boost-1.34.0-beta1/boost/archive/polymorphic_oarchive.hpp ./boost/archive/polymorphic_oarchive.hpp
+ + virtual ~polymorphic_oarchive() {}
For what it's worth, I've been maintaining a similar local patch against 1.33.1 and have determined that it needs to be applied to 1.34.0 as well. Below is the comment associated with the patch:
+ // kab, 9/26/06: Avoid destructor slicing when using polymorphic archives, + // where clients may not know the precise type. The need for this was + // reported to Robert Ramey (via boost developers list), where he + // acknowledged the problem and said he would fix in a future release. + virtual ~polymorphic_iarchive() { /* nothing to do here */ }
I believe that date was post-RC_1_34_0 branch, and in fact I think at the time it was thought that boost 1.34.0 was immanent.
Hm. But reviewing the email thread I see that Robert ultimately decided not to make this change, for reasons that I didn't (and still don't) understand (and apparently forgot to pursue). See:
I don't really understand this at all. I thought the whole point of polymorphic_text_*archive was so you could derive from it and re-implement the various load/save methods. The whole point being that you can write your own format and use runtime dispatch ala classical serialization...after a quick look, though I guess I don't understand.
So I would suggest that this might not be a simple and obviously safe change for boost 1.34.0.
Actually I find it hard to see how it will do any harm either. The class already has a virtual table so it can't increase the size of an instance. The accessibility isn't changed. I guess Robert will need to explain... Jeff