Opened 7 years ago
Closed 6 years ago
#12097 closed Bugs (wontfix)
missing virtual destructor
Reported by: | 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)
follow-up: 2 comment:1 by , 7 years ago
comment:2 by , 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 , 7 years ago
Yes, I'm sure. There are no derived classes of error_info_container_impl.
comment:5 by , 6 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
There is no undefined behavior. This destructor is never used in a way that requires it to be virtual.