Opened 7 years ago

Closed 6 years ago

#12097 closed Bugs (wontfix)

missing virtual destructor

Reported by: josopait@… Owned by: Emil Dotchevski
Milestone: To Be Determined Component: exception
Version: Boost 1.60.0 Severity: Problem
Keywords: virtual destructor Cc:

Description

When compiling my program with g++ -Wdelete-non-virtual-dtor -Wsystem-headers I get warnings about a missing virtual destructor in boost. I recommend making the destructor of error_info_container virtual to avoid undefined behavior and to prevent memory leaks:

file exception/exception.hpp:

virtual ~error_info_container() throw() { }

Change History (5)

comment:1 by Steven Watanabe, 7 years ago

There is no undefined behavior. This destructor is never used in a way that requires it to be virtual.

in reply to:  1 comment:2 by josopait@…, 7 years ago

Replying to steven_watanabe:

There is no undefined behavior. This destructor is never used in a way that requires it to be virtual.

Are you sure? The line

delete this;

in file exception/info.hpp does look suspicious.

comment:3 by Steven Watanabe, 7 years ago

Yes, I'm sure. There are no derived classes of error_info_container_impl.

comment:4 by josopait@…, 7 years ago

Ok, then it should be safe.

comment:5 by Emil Dotchevski, 6 years ago

Resolution: wontfix
Status: newclosed
Note: See TracTickets for help on using tickets.