This code is invalid, but is accepted by GCC:
// snip
struct Viral {
struct Dose { };
protected:
~Viral() throw (Dose) { }
};
struct Base : virtual Viral {
virtual ~Base() throw() { }
};
struct Derived : Base { };
// snap
~Derived calls ~Viral, which adds "Dose" to its exception spec. This yields to
a looser exception spec for ~Derived than for the overridden ~Base, which
should yield to an ill-formed program.
--
Summary: Wrongly computed exception specification for destructor
Product: gcc
Version: 4.5.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: schaub-johannes at web dot de
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45657