Throwing in destructors has always been considered dangerous and ill advised and in C++11, destructors default to noexcept(true)
. All throw statements in destructors become calls to std::terminate()
. If compiled with -Werror=terminate
, such statements will cause build failure. In order to enable C++98 exception throwing behaviour, destructors have to be explicitly marked noexcept(false)
. If, however, its class is part of a class hierarchy, all inherited destructors of the hierarchy must have an exception specification no less strict. This can be difficult to implement and, in cases of inheritance of classes from an extrernal project, impossible.
The only two throwing destructors in ASC are tn_file_buf_stream::~tn_file_buf_stream()
in source/simplestream.cpp
and tn_c_lzw_filestream::~tn_c_lzw_filestream()
in source/basestrm.cpp
. In both cases, throwing seems unnecesary. For ~tn_file_buf_stream()
, the throw message can be changed to a logging message.
Thanks for patch. However, these problems had already been fixed in the codebase.
I think it's time that I package a new release again...