Boost C++ Libraries: Ticket #9215: Infinite loop when `any` constructor called for `const any&&` https://svn.boost.org/trac10/ticket/9215 <p> Code at line 70 in boost/any.hpp must look like this: </p> <pre class="wiki"> template&lt;typename ValueType&gt; any(ValueType&amp;&amp; value , typename boost::disable_if&lt;boost::is_same&lt;any&amp;, ValueType&gt; &gt;::type* = 0 // disable if value has type `any&amp;` , typename boost::disable_if&lt;boost::is_const&lt;ValueType&gt; &gt;::type* = 0) // disable if value has type `const ValueType&amp;&amp;` : content(new holder&lt; typename remove_reference&lt;ValueType&gt;::type &gt;(static_cast&lt;ValueType&amp;&amp;&gt;(value))) { } </pre><p> Test case: </p> <pre class="wiki">#include &lt;boost/any.hpp&gt; #include &lt;string&gt; const boost::any getBoolVal() { return false; } int main() { boost::any vals[] = {1.0, std::string("1m"), getBoolVal()}; } </pre><p> Thanks to Bo Peng for finding this issue! </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/9215 Trac 1.4.3 Antony Polukhin Wed, 09 Oct 2013 11:37:46 GMT owner, status changed https://svn.boost.org/trac10/ticket/9215#comment:1 https://svn.boost.org/trac10/ticket/9215#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, 09 Oct 2013 14:34:17 GMT <link>https://svn.boost.org/trac10/ticket/9215#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9215#comment:2</guid> <description> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/86213" title="Fix for construction of `any` from `const any&amp;&amp;` (refs #9215)">[86213]</a>) Fix for construction of <code>any</code> from <code>const any&amp;&amp;</code> (refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/9215" title="#9215: Bugs: Infinite loop when `any` constructor called for `const any&amp;&amp;` (closed: fixed)">#9215</a>) </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Antony Polukhin</dc:creator> <pubDate>Mon, 14 Oct 2013 12:40:09 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/9215#comment:3 https://svn.boost.org/trac10/ticket/9215#comment:3 <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> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/86298" title="Merge from trunk: * Fixed construction of `any` from `const any&amp;&amp;` ...">[86298]</a>) Merge from trunk: </p> <ul><li>Fixed construction of <code>any</code> from <code>const any&amp;&amp;</code> (fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/9215" title="#9215: Bugs: Infinite loop when `any` constructor called for `const any&amp;&amp;` (closed: fixed)">#9215</a>) </li></ul> Ticket