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.
Not a regression, and G++ 4.6 correctly rejects it: pr.cc:12:8: error: looser throw specifier for 'virtual Derived::~Derived() throw (Viral::Dose)' pr.cc:9:11: error: overriding 'virtual Base::~Base() throw ()' EDG (Comeau online) also accepts it.
Great(In reply to comment #1) > Not a regression, and G++ 4.6 correctly rejects it: > > pr.cc:12:8: error: looser throw specifier for 'virtual Derived::~Derived() > throw (Viral::Dose)' > pr.cc:9:11: error: overriding 'virtual Base::~Base() throw ()' > > EDG (Comeau online) also accepts it. > Great, thanks for checking on 4.6. Can we mark it as resolved?
Jason, do you know if this was fixed as part of your noexcept work, or is it still latent in trunk?
I'm sure this was fixed by my work on implicitly deleted functions, which involved rewriting the calculation of exception specifications for implicitly declared functions.