Boost C++ Libraries: Ticket #4676: Ambiguous register_type with polymorphic_x_?archive on g++ https://svn.boost.org/trac10/ticket/4676 <p> Using the register_type&lt;&gt; mechanism with a polymorphic archive causes ambiguity errors on g++. </p> <p> Example and patch attached (for detail/polymorphic_?archive_route.hpp). </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/4676 Trac 1.4.3 boost@… Wed, 22 Sep 2010 18:36:38 GMT attachment set https://svn.boost.org/trac10/ticket/4676 https://svn.boost.org/trac10/ticket/4676 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">register_type_ambig.cpp</span> </li> </ul> <p> g++ register_type ambiguity </p> Ticket boost@… Wed, 22 Sep 2010 18:37:05 GMT attachment set https://svn.boost.org/trac10/ticket/4676 https://svn.boost.org/trac10/ticket/4676 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">register_type.patch</span> </li> </ul> <p> g++ register_type ambiguity patch </p> Ticket Richard Hazlewood Wed, 22 Sep 2010 18:38:17 GMT <link>https://svn.boost.org/trac10/ticket/4676#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4676#comment:1</guid> <description> <p> Note: this was with g++ 4.4 </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Robert Ramey</dc:creator> <pubDate>Sat, 25 Sep 2010 16:57:46 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4676#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4676#comment:2</guid> <description> <p> no way can I put a "using" declaration in a *.hpp file. </p> <p> What we can do is add the following to polymorphic_oarchive: </p> <pre class="wiki"> // register type function const basic_pointer_iserializer * register_type(T * t = NULL){ return ArchiveImplementation::register_type(t); } </pre><p> and similar block to polymorphic_oarchive. Would that not solve the issue. I've included this in my code base for eventual migration to trunk and release but don't have a specific test yet. Care to try this? </p> <p> Robert Ramey </p> </description> <category>Ticket</category> </item> <item> <author>Richard Hazlewood <boost@…></author> <pubDate>Sun, 26 Sep 2010 21:39:47 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4676#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4676#comment:3</guid> <description> <p> The "using" is a convenience (std: 7.3.3) to bring one of the routes to <strong>register_type&lt;&gt;</strong> into scope of the <strong>polymorphic_?archive_route</strong> classes. However, if you are concerned that a compiler may not support it, a routing <strong>register_type&lt;&gt;</strong>, as you specify, achieves the same ends - it matters not to me. </p> <p> However, I suspect it will have to go at the same place as the using patch; i.e. in the <strong>archive::detail::polymorphic_?archive_route</strong> classes. It is at this point in the hierarchy that the two ambiguous routes to <strong>register_type&lt;&gt;</strong> (interface_?archive) occur; taking <strong>polymorphic_binary_oarchive</strong> as an example: </p> <pre class="wiki">polymorphic_binary_oarchive: polymorphic_oarchive_route&lt;&gt; | ---------------------------------------- | | polymorphic_oarchive (ArchiveImplementation) | binary_oarchive_impl&lt;naked_binary_oarchive&gt; interface_oarchive&lt;poly_oa&gt; | basic_binary_oarchive&lt;naked_binary_oarchive&gt; | common_oarchive&lt;naked_binary_oarchive&gt; | ----------------------------- | | basic_oarchive interface_oarchive&lt;naked_binary_oarchive&gt; </pre><p> I'm happy to test anything you have; is it on a branch in the SVN repository? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Robert Ramey</dc:creator> <pubDate>Wed, 20 Oct 2010 16:08:31 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4676#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4676#comment:4</guid> <description> <p> I have fixed this, test it, and checked it into the trunk. </p> <p> Robert Ramey </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Robert Ramey</dc:creator> <pubDate>Wed, 20 Oct 2010 16:11:39 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/4676#comment:5 https://svn.boost.org/trac10/ticket/4676#comment:5 <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> Ticket