On Tue, Nov 18, 2014 at 7:00 PM, Olaf van der Spek
On Tue, Nov 18, 2014 at 4:59 PM, Andrey Semashev
wrote: On Tue, Nov 18, 2014 at 6:56 PM, Olaf van der Spek
wrote: Shouldn't ~noncopyable be noexcept?
I'm seeing this error:
class Cconnection : public Cclient, boost::noncopyable
connection.h:5:7: error: looser throw specifier for ‘virtual Cconnection::~Cconnection()’ In file included from connection.h:3:0, from connection.cpp:2: client.h:10:10: error: overriding ‘virtual Cclient::~Cclient() noexcept (true)’
Destructors are implicitly noexcept.
So it's a compiler bug?
From what I can see from the error message, the compiler complains about Cconnection::~Cconnection(), where Cconnection presumably derives from Cclient. Cclient::~Cclient() is noexcept while Cconnection::~Cconnection() is not. If Cconnection::~Cconnection() does not have non-empty exception specification or noexcept(false), it should be implicitly noexcept and the compiler is wrong here. This goes for compiler-generated Cconnection::~Cconnection() as well, unless some member has a throwing destructor.