The code: #include <stdexcept> #include <string> class der1 : public std::exception { std::string s;}; int main() { der1 d; return 0; }
gets you: ~/ootbc/common$ g++ foo.cc foo.cc:3: error: looser throw specifier for 'virtual der1::~der1()' /usr/include/c++/4.1.0/exception:58: error: overriding 'virtual std::exception::~exception() throw ()' I understand that the throw specification (an abortion in general IMO; why it was ever adopted after the experience with CLU is beyond me) of an overload in a derived class but be a subset of the specifications in the overloaded functions in the base class(es). However in the case of implicitly generated functions, requiring the user to explicitly say: ~der1() throw() {} in the derived class is just silly. It also introduces non-portable implementation dependencies where, as here, the base class is a system class with unknown and frequently changing throw specification that vary across hosts. Ivan -- Summary: pointless error on implicit destructor Product: gcc Version: 4.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: igodard at pacbell dot net http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29466