Boost C++ Libraries: Ticket #5487: Trying to get<nullptr_t> from a variant results in error with vs10 https://svn.boost.org/trac10/ticket/5487 <p> Trying to retrieve a nullptr_t type object from a boost variant with get&lt;std::nullptr_t&gt; on vs 2010 sp1 results in a: </p> <p> error C2666: 'boost::detail::addressof_impl&lt;T&gt;::f' : 2 overloads have similar conversions </p> <p> error. The same code compiles fine on gcc 4.6.0. </p> <p> See attached minimal sample. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/5487 Trac 1.4.3 dd0t@… Mon, 18 Apr 2011 22:50:47 GMT attachment set https://svn.boost.org/trac10/ticket/5487 https://svn.boost.org/trac10/ticket/5487 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">nullptr_t_in_variant.cpp</span> </li> </ul> <p> Minimal example reproducing the problem </p> Ticket Antony Polukhin Tue, 10 Dec 2013 15:45:19 GMT owner, component changed; cc set https://svn.boost.org/trac10/ticket/5487#comment:1 https://svn.boost.org/trac10/ticket/5487#comment:1 <ul> <li><strong>cc</strong> <span class="trac-author">antoshkka@…</span> added </li> <li><strong>owner</strong> changed from <span class="trac-author">ebf</span> to <span class="trac-author">No-Maintainer</span> </li> <li><strong>component</strong> <span class="trac-field-old">variant</span> → <span class="trac-field-new">utility</span> </li> </ul> <p> Even a simpler example: </p> <pre class="wiki">#include &lt;boost/utility/addressof.hpp&gt; int main() { auto p = nullptr; boost::addressof(p); } </pre><p> Code above results gives the same error on MSVC11: </p> <pre class="wiki">F:\boost_1_55_0\boost/utility/addressof.hpp(59): error C2666: 'boost::detail::addressof_impl&lt;T&gt;::f' : 2 overloads have similar conversions 1&gt; with 1&gt; [ 1&gt; T=nullptr 1&gt; ] 1&gt; F:\boost_1_55_0\boost/utility/addressof.hpp(43): could be 'nullptr *boost::detail::addressof_impl&lt;T&gt;::f(T *,int)' 1&gt; with 1&gt; [ 1&gt; T=nullptr 1&gt; ] 1&gt; F:\boost_1_55_0\boost/utility/addressof.hpp(37): or 'nullptr *boost::detail::addressof_impl&lt;T&gt;::f(T &amp;,long)' 1&gt; with 1&gt; [ 1&gt; T=nullptr 1&gt; ] 1&gt; while trying to match the argument list '(boost::detail::addr_impl_ref&lt;T&gt;, int)' 1&gt; with 1&gt; [ 1&gt; T=nullptr 1&gt; ] 1&gt; main.cpp(5) : see reference to function template instantiation 'T *boost::addressof&lt;nullptr&gt;(T &amp;)' being compiled 1&gt; with 1&gt; [ 1&gt; T=nullptr 1&gt; ] </pre><p> While GCC compiles successfully. </p> Ticket Marshall Clow Tue, 10 Dec 2013 19:20:45 GMT <link>https://svn.boost.org/trac10/ticket/5487#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5487#comment:2</guid> <description> <p> Also fails on a (fairly recent) clang: </p> <pre class="wiki">$ clang++ -std=c++11 -stdlib=libc++ -I /Sources/boost/SVN/release/ boost.cpp In file included from boost.cpp:1: /Sources/boost/SVN/release/boost/utility/addressof.hpp:59:12: error: call to 'f' is ambiguous return boost::detail::addressof_impl&lt;T&gt;::f( boost::detail::addr_impl... ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ boost.cpp:5:5: note: in instantiation of function template specialization 'boost::addressof&lt;nullptr_t&gt;' requested here boost::addressof(p); ^ /Sources/boost/SVN/release/boost/utility/addressof.hpp:37:23: note: candidate function static inline T * f( T &amp; v, long ) ^ /Sources/boost/SVN/release/boost/utility/addressof.hpp:43:23: note: candidate function static inline T * f( T * v, int ) ^ 1 error generated. </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>Marshall Clow</dc:creator> <pubDate>Tue, 10 Dec 2013 19:22:19 GMT</pubDate> <title>owner changed https://svn.boost.org/trac10/ticket/5487#comment:3 https://svn.boost.org/trac10/ticket/5487#comment:3 <ul> <li><strong>owner</strong> changed from <span class="trac-author">No-Maintainer</span> to <span class="trac-author">Peter Dimov</span> </li> </ul> Ticket Peter Dimov Wed, 11 Dec 2013 19:05:45 GMT <link>https://svn.boost.org/trac10/ticket/5487#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5487#comment:4</guid> <description> <p> Should be fixed in <a class="ext-link" href="https://github.com/boostorg/utility/commit/50eafe2027dfd45432fb7d97074e10cadb9bd899"><span class="icon">​</span>https://github.com/boostorg/utility/commit/50eafe2027dfd45432fb7d97074e10cadb9bd899</a> </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Peter Dimov</dc:creator> <pubDate>Wed, 11 Dec 2013 22:15:32 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/5487#comment:5 https://svn.boost.org/trac10/ticket/5487#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