Boost C++ Libraries: Ticket #10727: polymorphic serialization of shared_ptr fails https://svn.boost.org/trac10/ticket/10727 <p> This issue arised in boost 1.56 and got reported here the first time: </p> <p> <a class="ext-link" href="http://lists.boost.org/boost-users/2014/08/82735.php"><span class="icon">​</span>http://lists.boost.org/boost-users/2014/08/82735.php</a> </p> <p> the answer reported this as being a likely duplicate of another fixed bug. I reported the bug later via the mailing list twice(1.56 after code analysis and 1.57 beta1) so now the official bug report to make it more official. </p> <p> "taking a look at the trac ticket in the answer: <a class="ext-link" href="https://svn.boost.org/trac/boost/ticket/10348"><span class="icon">​</span>https://svn.boost.org/trac/boost/ticket/10348</a> i came to the conclusion that this is not the same bug. the ticket there reported an error due to missing includes. However, the bug in the polymorphic archives is different as the polymorphic_iarchive class does not derive from detail::helper_collection (however the polymorphic_*_iarchive class do as they derive from *_iarchive via polymorphic_iarchive_rout) and thus a call to ar.template get_helper&lt;T&gt;() will fail when ar is the polymorphic_iarchive class. I am not sure how to fix this easily." </p> <p> Here is the error: </p> <p> /include/boost/serialization/shared_ptr.hpp:170:9: error: 'class boost::archive::polymorphic_iarchive' has no member named 'get_helper' </p> <p> the first link contains already a minimal example to reproduce the error. </p> <p> I would love to see it fixed prior to 1.57 </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/10727 Trac 1.4.3 Robert Ramey Thu, 13 Nov 2014 17:39:13 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/10727#comment:1 https://svn.boost.org/trac10/ticket/10727#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> fixed in <a class="ext-link" href="https://svn.boost.org/trac/boost/ticket/10348"><span class="icon">​</span>https://svn.boost.org/trac/boost/ticket/10348</a> </p> Ticket oswin.kraus@… Thu, 18 Dec 2014 09:32:55 GMT <link>https://svn.boost.org/trac10/ticket/10727#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10727#comment:2</guid> <description> <p> Sorry, this is NOT fixed. Please at least pretend to take a look into it. </p> <p> boost 1.57 fresh checkout on <a class="missing wiki">ArchLinux</a> </p> <p> /home/ulfi/Shark/src/Models/Centroids.cpp:163:1: required from here /usr/include/boost/serialization/shared_ptr.hpp:170:9: error: 'class boost::archive::polymorphic_iarchive' has no member named 'get_helper' </p> <blockquote> <p> ); </p> </blockquote> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Thu, 18 Dec 2014 09:44:12 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10727#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10727#comment:3</guid> <description> <p> and a minimal example: </p> <p> #include &lt;boost/shared_ptr.hpp&gt; #include &lt;boost/archive/polymorphic_text_iarchive.hpp&gt; #include &lt;fstream&gt; #include &lt;boost/serialization/shared_ptr.hpp&gt; #include &lt;boost/serialization/vector.hpp&gt;<em>something to de-serialize int main(){ std::ifstream i("foo"); </em></p> <blockquote> <p> boost::archive::polymorphic_text_iarchive ia(i); boost::archive::polymorphic_iarchive &amp; ia_interface = ia; boost::shared_ptr&lt;std::vector&lt;int&gt; &gt; p; ia_interface &gt;&gt; p; </p> </blockquote> <p> } </p> <p> boost version #define BOOST_VERSION 105700 </p> <p> error </p> <p> In file included from /home/ulfi/feyidata/main.cpp:6:0: /usr/include/boost/serialization/shared_ptr.hpp: In instantiation of 'void boost::serialization::load(Archive&amp;, boost::shared_ptr&lt;U&gt;&amp;, unsigned int) [with Archive = boost::archive::polymorphic_iarchive; T = std::vector&lt;int&gt;]': /usr/include/boost/serialization/split_free.hpp:58:22: required from 'static void boost::serialization::free_loader&lt;Archive, T&gt;::invoke(Archive&amp;, T&amp;, unsigned int) [with Archive = boost::archive::polymorphic_iarchive; T = boost::shared_ptr&lt;std::vector&lt;int&gt; &gt;]' /usr/include/boost/serialization/split_free.hpp:74:38: required from 'void boost::serialization::split_free(Archive&amp;, T&amp;, unsigned int) [with Archive = boost::archive::polymorphic_iarchive; T = boost::shared_ptr&lt;std::vector&lt;int&gt; &gt;]' /usr/include/boost/serialization/shared_ptr.hpp:187:57: required from 'void boost::serialization::serialize(Archive&amp;, boost::shared_ptr&lt;U&gt;&amp;, unsigned int) [with Archive = boost::archive::polymorphic_iarchive; T = std::vector&lt;int&gt;]' /usr/include/boost/serialization/serialization.hpp:128:27: required from 'void boost::serialization::serialize_adl(Archive&amp;, T&amp;, unsigned int) [with Archive = boost::archive::polymorphic_iarchive; T = boost::shared_ptr&lt;std::vector&lt;int&gt; &gt;]' /usr/include/boost/archive/detail/iserializer.hpp:188:5: [ skipping 2 instantiation contexts, use -ftemplate-backtrace-limit=0 to disable ] /usr/include/boost/archive/detail/iserializer.hpp:410:13: required from 'static void boost::archive::detail::load_non_pointer_type&lt;Archive&gt;::load_standard::invoke(Archive&amp;, const T&amp;) [with T = boost::shared_ptr&lt;std::vector&lt;int&gt; &gt;; Archive = boost::archive::polymorphic_iarchive]' /usr/include/boost/archive/detail/iserializer.hpp:462:28: required from 'static void boost::archive::detail::load_non_pointer_type&lt;Archive&gt;::invoke(Archive&amp;, T&amp;) [with T = boost::shared_ptr&lt;std::vector&lt;int&gt; &gt;; Archive = boost::archive::polymorphic_iarchive]' /usr/include/boost/archive/detail/iserializer.hpp:618:24: required from 'void boost::archive::load(Archive&amp;, T&amp;) [with Archive = boost::archive::polymorphic_iarchive; T = boost::shared_ptr&lt;std::vector&lt;int&gt; &gt;]' /usr/include/boost/archive/polymorphic_iarchive.hpp:107:40: required from 'void boost::archive::polymorphic_iarchive_impl::load_override(T&amp;, int) [with T = boost::shared_ptr&lt;std::vector&lt;int&gt; &gt;]' /usr/include/boost/archive/detail/interface_iarchive.hpp:60:9: required from 'Archive&amp; boost::archive::detail::interface_iarchive&lt;Archive&gt;::operator&gt;&gt;(T&amp;) [with T = boost::shared_ptr&lt;std::vector&lt;int&gt; &gt;; Archive = boost::archive::polymorphic_iarchive]' /home/ulfi/feyidata/main.cpp:13:21: required from here /usr/include/boost/serialization/shared_ptr.hpp:170:9: error: 'class boost::archive::polymorphic_iarchive' has no member named 'get_helper' </p> <blockquote> <p> ); </p> </blockquote> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Thu, 18 Dec 2014 15:44:11 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10727#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10727#comment:4</guid> <description> <p> This fixed on the development branch. Within a couple of days, this will be merged to the master branch so it will appear in version 1.58 of boost. If your need is more urgent, you can tweak your local boost installation in accordance with the code in the development branch. In the case of boost serialization shared_ptr helper, it's pretty easy as it's just a header not involved in the library so you don't have to rebuild boost. That is, just update/add the missing header and you're in business. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Thu, 18 Dec 2014 22:14:14 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10727#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10727#comment:5</guid> <description> <p> Could you provide me with a pointer on how to get the required patch? I have not set up a boost development environment and don't know how. But I am eager to test this as our software relies on this working... </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Robert Ramey</dc:creator> <pubDate>Wed, 08 Apr 2015 17:52:12 GMT</pubDate> <title>status changed; resolution deleted https://svn.boost.org/trac10/ticket/10727#comment:6 https://svn.boost.org/trac10/ticket/10727#comment:6 <ul> <li><strong>status</strong> <span class="trac-field-old">closed</span> → <span class="trac-field-new">reopened</span> </li> <li><strong>resolution</strong> <span class="trac-field-deleted">fixed</span> </li> </ul> <p> OK - I looked at this more carefully. There were a couple of issues with the update to shared_ptr seriaiization which I addressed. I didn't realized that this is a different one. </p> <p> The crux of the issue is that polymorphic archives need to be updated to support the new helper functionality. It's not a trivial fix, but it is is doable. </p> <p> I'll try go the to it soon. Meanwhile I've re-opened this ticket so it doesn't get lost. </p> <p> Robert Ramey </p> Ticket dave.lowell@… Mon, 13 Apr 2015 17:31:40 GMT cc set https://svn.boost.org/trac10/ticket/10727#comment:7 https://svn.boost.org/trac10/ticket/10727#comment:7 <ul> <li><strong>cc</strong> <span class="trac-author">dave.lowell@…</span> added </li> </ul> Ticket Robert Ramey Fri, 24 Apr 2015 21:07:42 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/10727#comment:8 https://svn.boost.org/trac10/ticket/10727#comment:8 <ul> <li><strong>status</strong> <span class="trac-field-old">reopened</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> I beiieved I've fixed this now so I'm closing this ticket </p> Ticket anonymous Sun, 26 Apr 2015 13:22:42 GMT status, version changed; resolution deleted https://svn.boost.org/trac10/ticket/10727#comment:9 https://svn.boost.org/trac10/ticket/10727#comment:9 <ul> <li><strong>status</strong> <span class="trac-field-old">closed</span> → <span class="trac-field-new">reopened</span> </li> <li><strong>version</strong> <span class="trac-field-old">Boost 1.56.0</span> → <span class="trac-field-new">Boost 1.58.0</span> </li> <li><strong>resolution</strong> <span class="trac-field-deleted">fixed</span> </li> </ul> Ticket Robert Ramey Sun, 26 Apr 2015 13:40:51 GMT <link>https://svn.boost.org/trac10/ticket/10727#comment:10 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10727#comment:10</guid> <description> <p> Hmmm - is there a reason for re-opening this? </p> <p> I added a specific test for the combination of polymorphic archives and serialization helper. Then I made changes such that this test passed. I have no indication that this is still an issue. </p> </description> <category>Ticket</category> </item> <item> <author>dave.lowell@…</author> <pubDate>Wed, 29 Apr 2015 14:55:34 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10727#comment:11 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10727#comment:11</guid> <description> <p> what was the change to fix this? I'm wondering if there's a patch that could be applied to fix it in an earlier version of boost. </p> <p> (this is unrelated to the ticket being reopened) </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Robert Ramey</dc:creator> <pubDate>Tue, 29 Sep 2015 21:03:01 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10727#comment:12 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10727#comment:12</guid> <description> <p> Is this still an issue? Could you re-test? </p> </description> <category>Ticket</category> </item> <item> <author>marco.craveiro@…</author> <pubDate>Tue, 06 Oct 2015 16:50:13 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10727#comment:13 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10727#comment:13</guid> <description> <p> Hi, </p> <p> I've upgraded from boost 1.55 to boost 1.58 in debian testing; my code<a class="changeset" href="https://svn.boost.org/trac10/changeset/1" title="Import core sources for SVNmanger 0.38 ">[1]</a> compiles successfully with 1.55<a class="changeset" href="https://svn.boost.org/trac10/changeset/2" title="Add Boost Disclaimer">[2]</a> but now fails with 1.58. Are there any changes required when moving to boost 1.58 from a serialisation perspective? An example of a file not compiling is <a class="changeset" href="https://svn.boost.org/trac10/changeset/3" title="Tweak disclaimer text">[3]</a>, with the error: </p> <p> /usr/include/boost/archive/detail/iserializer.hpp:462:28: required from ‘static void boost::archive::detail::load_non_pointer_type&lt;Archive&gt;::invoke(Archive&amp;, T&amp;) [with T = std::vector&lt;boost::shared_ptr&lt;dogen::dia::attribute&gt; &gt;; Archive = boost::archive::polymorphic_iarchive]’ /usr/include/boost/archive/detail/iserializer.hpp:618:24: required from ‘void boost::archive::load(Archive&amp;, T&amp;) [with Archive = boost::archive::polymorphic_iarchive; T = std::vector&lt;boost::shared_ptr&lt;dogen::dia::attribute&gt; &gt;]’ /usr/include/boost/archive/polymorphic_iarchive.hpp:119:48: required from ‘void boost::archive::polymorphic_iarchive_impl::load_override(const boost::serialization::nvp&lt;T&gt;&amp;, int) [with T = std::vector&lt;boost::shared_ptr&lt;dogen::dia::attribute&gt; &gt;]’ /usr/include/boost/archive/detail/interface_iarchive.hpp:60:9: required from ‘Archive&amp; boost::archive::detail::interface_iarchive&lt;Archive&gt;::operator&gt;&gt;(T&amp;) [with T = const boost::serialization::nvp&lt;std::vector&lt;boost::shared_ptr&lt;dogen::dia::attribute&gt; &gt; &gt;; Archive = boost::archive::polymorphic_iarchive]’ ../../../projects/dia/src/serialization/composite_ser.cpp:53:8: required from ‘void boost::serialization::load(Archive&amp;, dogen::dia::composite&amp;, unsigned int) [with Archive = boost::archive::polymorphic_iarchive]’ ../../../projects/dia/src/serialization/composite_ser.cpp:63:101: required from here /usr/include/boost/serialization/shared_ptr.hpp:170:9: error: ‘class boost::archive::polymorphic_iarchive’ has no member named ‘get_helper’ ninja: build stopped: subcommand failed. </p> <p> Many thanks for your time and for boost serialisation. </p> <p> Marco </p> <p> note: pls add protocol as required, blocked by track for some reason. </p> <p> <a class="changeset" href="https://svn.boost.org/trac10/changeset/1" title="Import core sources for SVNmanger 0.38 ">[1]</a> github.com/DomainDrivenConsulting/dogen <a class="changeset" href="https://svn.boost.org/trac10/changeset/2" title="Add Boost Disclaimer">[2]</a> travis-ci.org/DomainDrivenConsulting/dogen/builds <a class="changeset" href="https://svn.boost.org/trac10/changeset/3" title="Tweak disclaimer text">[3]</a> github.com/DomainDrivenConsulting/dogen/blob/master/projects/dia/src/serialization/composite_ser.cpp </p> </description> <category>Ticket</category> </item> <item> <author>marco.craveiro@…</author> <pubDate>Wed, 07 Oct 2015 15:58:58 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10727#comment:14 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10727#comment:14</guid> <description> <p> After spending some time looking at this, it seems that the version of boost 1.58 in debian will just not work for polymorphic archives - removing polymorphic archives compiles fine, but not otherwise. I ended up building boost 1.59 manually and that seems to have solved my problems. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Robert Ramey</dc:creator> <pubDate>Wed, 07 Oct 2015 16:05:14 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/10727#comment:15 https://svn.boost.org/trac10/ticket/10727#comment:15 <ul> <li><strong>status</strong> <span class="trac-field-old">reopened</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> OK - so it's fixed in 1.59 - I'll close this ticket </p> Ticket