Boost C++ Libraries: Ticket #8100: boost::any can't be empty https://svn.boost.org/trac10/ticket/8100 <pre class="wiki">any() : content(0) { } ~any() { delete content; } </pre><p> should be replaced i guess by : </p> <pre class="wiki">any() : content(0) { } ~any() { if (content != 0) delete content; } </pre><p> else an empty boost::any crashes at destruction, and other operations can fail like : </p> <pre class="wiki">template&lt;typename ValueType&gt; any &amp; operator=(const ValueType &amp; rhs) { any(rhs).swap(*this); return *this; } </pre><p> if this-&gt;content is null then the local any(rhs) after the swap has a null content, provoking a fail at destruction. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/8100 Trac 1.4.3 Steven Watanabe Tue, 19 Feb 2013 04:19:03 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/8100#comment:1 https://svn.boost.org/trac10/ticket/8100#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">invalid</span> </li> </ul> <p> Deleting a null pointer is legal and has no effect. (see C++03 5.3.5.2) </p> Ticket ThiSpawn <thispawn@…> Tue, 19 Feb 2013 05:14:01 GMT keywords deleted https://svn.boost.org/trac10/ticket/8100#comment:2 https://svn.boost.org/trac10/ticket/8100#comment:2 <ul> <li><strong>keywords</strong> content any destructor removed </li> </ul> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/8100#comment:1" title="Comment 1">steven_watanabe</a>: </p> <blockquote class="citation"> <p> Deleting a null pointer is legal and has no effect. (see C++03 5.3.5.2) </p> </blockquote> <p> Lack of coffee, my allocators were overriden by some with no checks, my debugger did let me believe deleting a null pointer was not legal. Sorry for this inconvience. </p> Ticket