Boost C++ Libraries: Ticket #10882: error C2668: 'boost::swap' : ambiguous call to overloaded function (MSVC) https://svn.boost.org/trac10/ticket/10882 <p> The attached source file does not compile with a specific version of MSVC compiler. It complains about 'boost::swap' ambiguous call to overloaded function, which could be void boost::swap or void boost::detail::variant::move_swap_fallback::swap. Compiler output and compiler version output attached. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/10882 Trac 1.4.3 Gabor Marton <martongabesz@…> Thu, 18 Dec 2014 11:27:45 GMT attachment set https://svn.boost.org/trac10/ticket/10882 https://svn.boost.org/trac10/ticket/10882 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">boost_variant_bug.cpp</span> </li> </ul> Ticket Gabor Marton <martongabesz@…> Thu, 18 Dec 2014 11:29:32 GMT attachment set https://svn.boost.org/trac10/ticket/10882 https://svn.boost.org/trac10/ticket/10882 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">compiler_output</span> </li> </ul> Ticket Gabor Marton <martongabesz@…> Thu, 18 Dec 2014 11:30:32 GMT attachment set https://svn.boost.org/trac10/ticket/10882 https://svn.boost.org/trac10/ticket/10882 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">compiler_version</span> </li> </ul> Ticket Gabor Marton <martongabesz@…> Thu, 18 Dec 2014 13:15:38 GMT <link>https://svn.boost.org/trac10/ticket/10882#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10882#comment:1</guid> <description> <p> Possibly related to: <a class="ext-link" href="https://svn.boost.org/trac/boost/ticket/2839"><span class="icon">​</span>https://svn.boost.org/trac/boost/ticket/2839</a> </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Antony Polukhin</dc:creator> <pubDate>Fri, 26 Dec 2014 11:12:27 GMT</pubDate> <title>owner, status, milestone changed https://svn.boost.org/trac10/ticket/10882#comment:2 https://svn.boost.org/trac10/ticket/10882#comment:2 <ul> <li><strong>owner</strong> changed from <span class="trac-author">ebf</span> to <span class="trac-author">Antony Polukhin</span> </li> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> <li><strong>milestone</strong> <span class="trac-field-old">To Be Determined</span> → <span class="trac-field-new">Boost 1.58.0</span> </li> </ul> Ticket Antony Polukhin Fri, 26 Dec 2014 13:50:18 GMT <link>https://svn.boost.org/trac10/ticket/10882#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10882#comment:3</guid> <description> <p> Fixed in <a class="ext-link" href="https://github.com/boostorg/variant/commit/1e1a81536c329e31f32261e308629b4c2847eb6f"><span class="icon">​</span>develop branch</a>. tests added in <a class="ext-link" href="https://github.com/boostorg/variant/commit/da89ab5633f1577ef639460db2ac0deeff4d3486"><span class="icon">​</span>this commit</a>. Will be merged to the master branch soon. </p> </description> <category>Ticket</category> </item> <item> <author>Thomas Riccardi <riccardi@…></author> <pubDate>Tue, 13 Jan 2015 12:18:40 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10882#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10882#comment:4</guid> <description> <p> Since which Boost version this issue is present? At least 1.56, but what about earlier versions (like 1.55)? </p> <p> And does this ambiguous call resolution cause a risk on other compilers (like gcc)? Does it work by luck on gcc? Is this luck stable? Or is there a risk that under some more complicated scenario the issue could happen on gcc too (without the fix)? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Antony Polukhin</dc:creator> <pubDate>Tue, 13 Jan 2015 12:42:42 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10882#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10882#comment:5</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/10882#comment:4" title="Comment 4">Thomas Riccardi &lt;riccardi@…&gt;</a>: </p> <blockquote class="citation"> <p> Since which Boost version this issue is present? At least 1.56, but what about earlier versions (like 1.55)? </p> </blockquote> <p> Looks like this issue exists from the very beginning of the Varinat library. </p> <blockquote class="citation"> <p> And does this ambiguous call resolution cause a risk on other compilers (like gcc)? </p> </blockquote> <p> Yes </p> <blockquote class="citation"> <p> Does it work by luck on gcc? Is this luck stable? Or is there a risk that under some more complicated scenario the issue could happen on gcc too (without the fix)? </p> </blockquote> <p> Issue happen if a class located in <code>boost::</code> namespace is being swapped and <code>boost/swap.hpp</code> is included. Anyway, it's a compile-time error, so you'll definitely know if you are hit by this issue. </p> </description> <category>Ticket</category> </item> <item> <author>Thomas Riccardi <riccardi@…></author> <pubDate>Thu, 22 Jan 2015 16:18:55 GMT</pubDate> <title>attachment set https://svn.boost.org/trac10/ticket/10882 https://svn.boost.org/trac10/ticket/10882 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">boost-1.57.0-fix-boost-variant-ambiguous-call-to-swap-boost-trac-10882.patch</span> </li> </ul> <p> fix backported on boost 1.57.0 </p> Ticket Thomas Riccardi <riccardi@…> Thu, 22 Jan 2015 16:19:18 GMT attachment set https://svn.boost.org/trac10/ticket/10882 https://svn.boost.org/trac10/ticket/10882 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">boost-1.55.0-fix-boost-variant-ambiguous-call-to-swap-boost-trac-10882.patch</span> </li> </ul> <p> fix backported on boost 1.55.0 </p> Ticket Thomas Riccardi <riccardi@…> Thu, 22 Jan 2015 16:20:35 GMT <link>https://svn.boost.org/trac10/ticket/10882#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10882#comment:6</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/10882#comment:5" title="Comment 5">apolukhin</a>: </p> <blockquote class="citation"> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/10882#comment:4" title="Comment 4">Thomas Riccardi &lt;riccardi@…&gt;</a>: </p> <blockquote class="citation"> <p> Since which Boost version this issue is present? At least 1.56, but what about earlier versions (like 1.55)? </p> </blockquote> <p> Looks like this issue exists from the very beginning of the Varinat library. </p> <blockquote class="citation"> <p> And does this ambiguous call resolution cause a risk on other compilers (like gcc)? </p> </blockquote> <p> Yes </p> <blockquote class="citation"> <p> Does it work by luck on gcc? Is this luck stable? Or is there a risk that under some more complicated scenario the issue could happen on gcc too (without the fix)? </p> </blockquote> <p> Issue happen if a class located in <code>boost::</code> namespace is being swapped and <code>boost/swap.hpp</code> is included. Anyway, it's a compile-time error, so you'll definitely know if you are hit by this issue. </p> </blockquote> <p> Thank you for all your precise answers. </p> <p> I added to this ticket 2 patches that backport the fix for this issue on boost 1.55.0 and 1.57.0. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Antony Polukhin</dc:creator> <pubDate>Mon, 09 Mar 2015 12:04:09 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/10882#comment:7 https://svn.boost.org/trac10/ticket/10882#comment:7 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> Ticket