Opened 13 years ago

Closed 13 years ago

#3315 closed Bugs (wontfix)

Compile-time instantiation causing failure to deserialize std::vector<char>.

Reported by: Jarl Lindrud <jarl.lindrud@…> Owned by: Robert Ramey
Milestone: Boost 1.40.0 Component: serialization
Version: Boost 1.39.0 Severity: Problem
Keywords: Cc:

Description

The attached code sample demonstrates the issue. If the commented out line in dummy() is reinstated, the deserialization test in main() fails. The behavior is the same for all versions of Boost.

A message was posted to Boost Developers mailing list 3 August 2009.

Attachments (1)

BoostSerializationBug.cpp (936 bytes ) - added by Jarl Lindrud <jarl.lindrud@…> 13 years ago.

Download all attachments as: .zip

Change History (2)

by Jarl Lindrud <jarl.lindrud@…>, 13 years ago

Attachment: BoostSerializationBug.cpp added

comment:1 by Robert Ramey, 13 years ago

Resolution: wontfix
Status: newclosed

I've looked into this. When the serialization traits of a type are

tracking = track_selectively implemenation_level <= object_serializable

No information regarding the type is included in the archive. This is decision based on efficiency considerations. The decision to track is dependent solely upon the code in the program. Thus the side effect of including code even it is not called. Note that default implementation of serialization of collections of primitive types such as vector<char> are setup with these traits.

So this behavior is by design. Whether or not this is a good design decision would be a different discussion. I wouldn't change it now since it would likely break a lot of archives "out there"

I did include a BOOST_STATIC_WARNING if one attempts to save a pointer to such a type. Doing this would be unusual and could result and archive which might be unreadable.

Note: See TracTickets for help on using tickets.