Boost C++ Libraries: Ticket #12615: any_cast should use addressof instead of operator & https://svn.boost.org/trac10/ticket/12615 <p> Please see attached test.cpp file for sample code. I have included compiler errors in the form of comments in the same. </p> <p> If a class has overloaded operator &amp; then any_cast (which uses &amp; itself) results in following type of compilation error. </p> <pre class="wiki">any.hpp:246:16: error: cannot initialize return object of type 'ExampleClass&lt;int&gt; *' with an rvalue of type 'const int **' </pre><p> I think fix is to replace use of &amp; operator with std::addressof. I have attached diff of changes to any.hpp which worked with clang++. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/12615 Trac 1.4.3 vishalshetye@… Mon, 21 Nov 2016 09:25:35 GMT attachment set https://svn.boost.org/trac10/ticket/12615 https://svn.boost.org/trac10/ticket/12615 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">test.cpp</span> </li> </ul> <p> sample code </p> Ticket vishalshetye@… Mon, 21 Nov 2016 09:26:15 GMT attachment set https://svn.boost.org/trac10/ticket/12615 https://svn.boost.org/trac10/ticket/12615 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">any_patch.txt</span> </li> </ul> <p> sample patch </p> Ticket Antony Polukhin Wed, 04 Jan 2017 09:42:45 GMT owner, status changed https://svn.boost.org/trac10/ticket/12615#comment:1 https://svn.boost.org/trac10/ticket/12615#comment:1 <ul> <li><strong>owner</strong> changed from <span class="trac-author">nasonov</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> </ul> Ticket Antony Polukhin Wed, 04 Jan 2017 09:43:54 GMT <link>https://svn.boost.org/trac10/ticket/12615#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/12615#comment:2</guid> <description> <p> Fixed in develop branch <a class="ext-link" href="https://github.com/boostorg/any/commit/7260f203d178e09d8d8b58406052b6dc1c432a48"><span class="icon">​</span>7260f203</a>. Will be merged into the master branche after the tests pass. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Antony Polukhin</dc:creator> <pubDate>Wed, 18 Jan 2017 19:37:22 GMT</pubDate> <title>milestone changed https://svn.boost.org/trac10/ticket/12615#comment:3 https://svn.boost.org/trac10/ticket/12615#comment:3 <ul> <li><strong>milestone</strong> <span class="trac-field-old">To Be Determined</span> → <span class="trac-field-new">Boost 1.64.0</span> </li> </ul> Ticket Antony Polukhin Sat, 22 Apr 2017 06:01:17 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/12615#comment:4 https://svn.boost.org/trac10/ticket/12615#comment:4 <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