#8100 closed Bugs (invalid)
boost::any can't be empty
Reported by: | Owned by: | nasonov | |
---|---|---|---|
Milestone: | To Be Determined | Component: | any |
Version: | Boost 1.52.0 | Severity: | Problem |
Keywords: | Cc: |
Description
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.
Change History (2)
follow-up: 2 comment:1 by , 10 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
comment:2 by , 10 years ago
Keywords: | content any destructor removed |
---|
Replying to steven_watanabe:
Deleting a null pointer is legal and has no effect. (see C++03 5.3.5.2)
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.
Note:
See TracTickets
for help on using tickets.
Deleting a null pointer is legal and has no effect. (see C++03 5.3.5.2)