Boost C++ Libraries: Ticket #12427: Boost Spirit: call of 'swap' is ambiguous https://svn.boost.org/trac10/ticket/12427 <p> I tried to compile a code with boost 1.58 and received the error below. The same code compiles with boost 1.55. </p> <p> Error: /usr/include/boost/spirit/home/support/attributes.hpp:1036:13: error: call of overloaded ‘swap(boost::fusion::vector3&lt;boost::shared_ptr&lt;insight::cad::Scalar&gt;, boost::shared_ptr&lt;insight::cad::Scalar&gt;, boost::shared_ptr&lt;insight::cad::Scalar&gt; &gt;&amp;, boost::fusion::vector3&lt;boost::shared_ptr&lt;insight::cad::Scalar&gt;, boost::shared_ptr&lt;insight::cad::Scalar&gt;, boost::shared_ptr&lt;insight::cad::Scalar&gt; &gt;&amp;)’ is ambiguous </p> <blockquote> <p> swap(a, b); </p> </blockquote> <p> /usr/include/boost/core/swap.hpp:54:8: note: candidate: void boost::swap(T1&amp;, T2&amp;) [with T1 = boost::fusion::vector3&lt;boost::shared_ptr&lt;insight::cad::Scalar&gt;, boost::shared_ptr&lt;insight::cad::Scalar&gt;, boost::shared_ptr&lt;insight::cad::Scalar&gt; &gt;; T2 = boost::fusion::vector3&lt;boost::shared_ptr&lt;insight::cad::Scalar&gt;, boost::shared_ptr&lt;insight::cad::Scalar&gt;, boost::shared_ptr&lt;insight::cad::Scalar&gt; &gt;] </p> <blockquote> <p> void swap(T1&amp; left, T2&amp; right) </p> </blockquote> <p> /usr/include/boost/fusion/sequence/intrinsic/swap.hpp:57:5: note: candidate: typename boost::fusion::result_of::swap&lt;Seq1, Seq2&gt;::type boost::fusion::swap(Seq1&amp;, Seq2&amp;) [with Seq1 = boost::fusion::vector3&lt;boost::shared_ptr&lt;insight::cad::Scalar&gt;, boost::shared_ptr&lt;insight::cad::Scalar&gt;, boost::shared_ptr&lt;insight::cad::Scalar&gt; &gt;; Seq2 = boost::fusion::vector3&lt;boost::shared_ptr&lt;insight::cad::Scalar&gt;, boost::shared_ptr&lt;insight::cad::Scalar&gt;, boost::shared_ptr&lt;insight::cad::Scalar&gt; &gt;; typename boost::fusion::result_of::swap&lt;Seq1, Seq2&gt;::type = void] </p> <blockquote> <p> swap(Seq1&amp; lhs, Seq2&amp; rhs) </p> </blockquote> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/12427 Trac 1.4.3 hannes@… Sat, 03 Sep 2016 16:50:08 GMT <link>https://svn.boost.org/trac10/ticket/12427#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12427#comment:1</guid> <description> <p> Since there is no reaction, I suppose that my given information is a little sparse? </p> <p> I investigated a bit: </p> <p> The definition of "boost::fusion::swap" arises due to the inclusion of "/usr/include/boost/spirit/include/qi.hpp" </p> <p> The definition of "boost::swap" comes via "/usr/include/boost/assign/list_of.hpp" Unfortunately, I need the "list_of" header in many places. </p> <p> I have removed all "using namespace" statements. Unfortunately without success. </p> </description> <category>Ticket</category> </item> <item> <author>hannes@…</author> <pubDate>Sat, 03 Sep 2016 17:41:04 GMT</pubDate> <title>attachment set https://svn.boost.org/trac10/ticket/12427 https://svn.boost.org/trac10/ticket/12427 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">test.cpp</span> </li> </ul> <p> Minimum example </p> Ticket hannes@… Sat, 03 Sep 2016 17:41:48 GMT <link>https://svn.boost.org/trac10/ticket/12427#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12427#comment:2</guid> <description> <p> I managed to reduce my code into a demonstration minimum. You can find it in the attached file "test.cpp". </p> <p> Compiling it on Ubuntu Xenial via </p> <blockquote> <p> $ g++ test.cpp </p> </blockquote> <p> fails with the described error. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Joel de Guzman</dc:creator> <pubDate>Sat, 03 Sep 2016 22:33:42 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/12427#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12427#comment:3</guid> <description> <p> I confirmed this and I can repro on Clang. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Joel de Guzman</dc:creator> <pubDate>Sat, 03 Sep 2016 22:45:48 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/12427#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12427#comment:4</guid> <description> <p> One plausible solution here is to use boost::swap and have fusion provide an overload for it. </p> </description> <category>Ticket</category> </item> <item> <author>hannes@…</author> <pubDate>Mon, 03 Oct 2016 18:02:44 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/12427#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12427#comment:5</guid> <description> <p> I could compile the minimum example after inserting </p> <pre class="wiki">namespace boost { namespace fusion { void swap(MyList&amp;a1, MyList&amp;a2) { boost:swap(a1, a2); } } } </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>Joel de Guzman</dc:creator> <pubDate>Sat, 24 Nov 2018 05:05:52 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/12427#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12427#comment:6</guid> <description> <p> fixed in boost-1.65 (not a spirit bug) </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Joel de Guzman</dc:creator> <pubDate>Sat, 24 Nov 2018 05:06:05 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/12427#comment:7 https://svn.boost.org/trac10/ticket/12427#comment:7 <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