Boost C++ Libraries: Ticket #5499: Serialization backward compatability https://svn.boost.org/trac10/ticket/5499 <p> Boost 1.33.1 serializes class_id_type as int_least16_t (archive version 3). Current boost tries to load it as int for archive of version 6 and earlier. On my platform (VS2005) int is 32 bits, hence the deserialization fails. </p> <p> The attached code creates and successfully loads 'out.boost103301.dat' when compiling with boost 1.33.1 and crashes due to failed assert in class_id_type constructor when loading with boost 1.46.1. </p> <p> I'm upgrading from 1.33.1 to boost 1.46.1 now, so I mark it as 'Showstopper'. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/5499 Trac 1.4.3 ybungalobill@… Sun, 24 Apr 2011 08:02:08 GMT attachment set https://svn.boost.org/trac10/ticket/5499 https://svn.boost.org/trac10/ticket/5499 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">serbug.zip</span> </li> </ul> Ticket s.skorniakov@… Thu, 26 Jan 2012 10:59:51 GMT <link>https://svn.boost.org/trac10/ticket/5499#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5499#comment:1</guid> <description> <p> Same problem while upgrading from 1.36.0 to 1.48.0. I had checked basic_binary_iarchive::load_override for class_id_type - from versions 1.32.0 to 1.43.0 (serialization library versions from 3 to 7) its identical: </p> <pre class="wiki"> void load_override(class_id_type &amp; t, int){ // upto 32K classes int_least16_t x; * this-&gt;This() &gt;&gt; x; t = class_id_type(x); } </pre><p> In version 1.44.0 (library version 8) load_override for class_id_type is not specialized in basic_binary_iarchive. In version 1.48.0 I see </p> <pre class="wiki"> library_version_type lvt = this-&gt;get_library_version(); if(boost::archive::library_version_type(7) &lt; lvt){ this-&gt;detail_common_iarchive::load_override(t, version); } else if(boost::archive::library_version_type(6) &lt; lvt){ int_least16_t x=0; * this-&gt;This() &gt;&gt; x; t = boost::archive::class_id_type(x); } else{ int x=0; * this-&gt;This() &gt;&gt; x; t = boost::archive::class_id_type(x); } </pre><p> I do not understand, why author made difference between version 7 and earlier versions. From my point of view, it is an error (introduced in version 1.45.0). Following code can read my old files (library versions 3-5) : </p> <pre class="wiki"> void load_override(class_id_type &amp; t, int version){ library_version_type lvt = this-&gt;get_library_version(); if(boost::archive::library_version_type(7) &lt; lvt){ this-&gt;detail_common_iarchive::load_override(t, version); } else { int_least16_t x=0; * this-&gt;This() &gt;&gt; x; t = boost::archive::class_id_type(x); } } </pre> </description> <category>Ticket</category> </item> </channel> </rss>