[Boost-bugs] [Boost C++ Libraries] #8100: boost::any can't be empty

Subject: [Boost-bugs] [Boost C++ Libraries] #8100: boost::any can't be empty
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-02-18 22:40:21


#8100: boost::any can't be empty
-------------------------------------------+--------------------------------
 Reporter: ThiSpawn <thispawn@…> | Owner: nasonov
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: any
  Version: Boost 1.52.0 | Severity: Problem
 Keywords: content any destructor |
-------------------------------------------+--------------------------------
 {{{
 any()
     : content(0)
 {
 }
 ~any()
 {
     delete content;
 }
 }}}

 should be replaced i guess by :

 {{{
 any()
     : content(0)
 {
 }
 ~any()
 {
     if (content != 0)
         delete content;
 }
 }}}

 else an empty boost::any crashes at destruction, and other operations can
 fail like :

 {{{
 template<typename ValueType>
 any & operator=(const ValueType & rhs)
 {
     any(rhs).swap(*this);
     return *this;
 }
 }}}
 if this->content is null then the local any(rhs) after the swap has a null
 content, provoking a fail at destruction.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/8100>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:12 UTC