http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56340
Bug #: 56340
Summary: Wrong error from exception specifications of defaulted
destructors
Classification: Unclassified
Product: gcc
Version: 4.7.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: [email protected]
ReportedBy: [email protected]
The following C++11 program incorrectly produces an error message in 4.7.2:
> cat tt.cc
class B
{
public:
virtual ~B() = default;
};
class D : public B
{
public:
virtual ~D() = default;
};
> g++ -std=c++11 -c tt.cc
tt.cc:10:11: error: looser throw specifier for ‘virtual D::~D()’
tt.cc:4:11: error: overriding ‘virtual B::~B() noexcept (true)’
The error vanishes if D's destructor declaration is removed (the same also
happens if B's destructor declaration is removed, but then the situation is
different because base class destructor is no longer virtual).