Boost C++ Libraries: Ticket #9053: Infinite recursion assigning "const any" with GCC 4.8 in C++11 mode https://svn.boost.org/trac10/ticket/9053 <p> Infinite recursion assigning "<code>const any</code>" with GCC 4.8 in C++11 mode because "<code>boost::disable_if&lt;boost::is_same&lt;any&amp;, ValueType&gt; &gt;</code>" is not triggered with a "<code>const any</code>". This leads to infinite recursion at run time with no compiler warnings. Happens with Boost 1.54.0 and boost-trunk. </p> <pre class="wiki">$ cat test-any.cpp #include &lt;iostream&gt; #include &lt;boost/any.hpp&gt; int main() { const boost::any a = 1; boost::any x = a; std::cout &lt;&lt; boost::any_cast&lt;int&gt;(x) &lt;&lt; std::endl; return 0; } $ g++ -g --std=c++11 -pedantic -Wall -Wextra -I ~/boost-trunk test-any.cpp $ gdb ./a.out (gdb) r Starting program: a.out Program received signal SIGSEGV, Segmentation fault. 0x00007ffff731f2e7 in _int_malloc () from /lib64/libc.so.6 (gdb) bt -10 #224597 0x0000000000401399 in boost::any::any&lt;boost::any const&gt;(boost::any const&amp;&amp;, boost::disable_if&lt;boost::is_same&lt;boost::any&amp;, boost::any const&gt;, void&gt;::type*) ( this=0x604098, value=&lt;unknown type in a.out, CU 0x0, DIE 0x4300&gt;) at boost-trunk/boost/any.hpp:80 #224598 0x00000000004014fa in boost::any::holder&lt;boost::any const&gt;::holder(boost::any const&amp;&amp;) (this=0x604090, value=&lt;unknown type in a.out, CU 0x0, DIE 0x44e1&gt;) at boost-trunk/boost/any.hpp:188 #224599 0x0000000000401399 in boost::any::any&lt;boost::any const&gt;(boost::any const&amp;&amp;, boost::disable_if&lt;boost::is_same&lt;boost::any&amp;, boost::any const&gt;, void&gt;::type*) ( this=0x604078, value=&lt;unknown type in a.out, CU 0x0, DIE 0x4300&gt;) at boost-trunk/boost/any.hpp:80 #224600 0x00000000004014fa in boost::any::holder&lt;boost::any const&gt;::holder(boost::any const&amp;&amp;) (this=0x604070, value=&lt;unknown type in a.out, CU 0x0, DIE 0x44e1&gt;) at boost-trunk/boost/any.hpp:188 #224601 0x0000000000401399 in boost::any::any&lt;boost::any const&gt;(boost::any const&amp;&amp;, boost::disable_if&lt;boost::is_same&lt;boost::any&amp;, boost::any const&gt;, void&gt;::type*) ( this=0x604058, value=&lt;unknown type in a.out, CU 0x0, DIE 0x4300&gt;) at boost-trunk/boost/any.hpp:80 #224602 0x00000000004014fa in boost::any::holder&lt;boost::any const&gt;::holder(boost::any const&amp;&amp;) (this=0x604050, value=&lt;unknown type in a.out, CU 0x0, DIE 0x44e1&gt;) at boost-trunk/boost/any.hpp:188 #224603 0x0000000000401399 in boost::any::any&lt;boost::any const&gt;(boost::any const&amp;&amp;, boost::disable_if&lt;boost::is_same&lt;boost::any&amp;, boost::any const&gt;, void&gt;::type*) ( this=0x604038, value=&lt;unknown type in a.out, CU 0x0, DIE 0x4300&gt;) at boost-trunk/boost/any.hpp:80 #224604 0x00000000004014fa in boost::any::holder&lt;boost::any const&gt;::holder(boost::any const&amp;&amp;) (this=0x604030, value=&lt;unknown type in a.out, CU 0x0, DIE 0x44e1&gt;) at boost-trunk/boost/any.hpp:188 #224605 0x0000000000401399 in boost::any::any&lt;boost::any const&gt;(boost::any const&amp;&amp;, boost::disable_if&lt;boost::is_same&lt;boost::any&amp;, boost::any const&gt;, void&gt;::type*) ( this=0x7fffffffdcb0, value=&lt;unknown type in a.out, CU 0x0, DIE 0x4300&gt;) at boost-trunk/boost/any.hpp:80 #224606 0x0000000000400e20 in main () at test-any.cpp:5 </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/9053 Trac 1.4.3 Antony Polukhin Sun, 20 Oct 2013 18:15:11 GMT status, milestone changed; resolution set https://svn.boost.org/trac10/ticket/9053#comment:1 https://svn.boost.org/trac10/ticket/9053#comment:1 <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">duplicate</span> </li> <li><strong>milestone</strong> <span class="trac-field-old">To Be Determined</span> → <span class="trac-field-new">Boost 1.55.0</span> </li> </ul> <p> Fixed. This is a duplicate of <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/9053" title="#9053: Bugs: Infinite recursion assigning &#34;const any&#34; with GCC 4.8 in C++11 mode (closed: duplicate)">#9053</a> </p> Ticket Di-an Jan <djan@…> Tue, 22 Oct 2013 16:38:29 GMT <link>https://svn.boost.org/trac10/ticket/9053#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9053#comment:2</guid> <description> <p> You mean this is a duplicate of <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>; otherwise we get an infinite recursion of bugs. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Antony Polukhin</dc:creator> <pubDate>Tue, 22 Oct 2013 19:35:47 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9053#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9053#comment:3</guid> <description> <p> Every bug is an exact duplicate of itself. But this one is also a duplicate of <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> <p> Thanks for the comment, it clarifies the situation! </p> </description> <category>Ticket</category> </item> </channel> </rss>