Created on 2017-02-28.00:00:00 last changed 48 months ago
Proposed resolution (November, 2018):
Change 14.5 [except.spec] paragraph 8 as follows:
The exception specification for an implicitly-declared destructor, or a destructor without a noexcept-specifier, is potentially-throwing if and only if any of the destructors for any of its potentially constructed subobjects ispotentially throwingpotentially-throwing or the destructor is virtual and the destructor of any virtual base class is potentially-throwing.
[Accepted as a DR at the February, 2019 meeting.]
According to 14.5 [except.spec] paragraph 8,
The exception specification for an implicitly-declared destructor, or a destructor without a noexcept-specifier, is potentially-throwing if and only if any of the destructors for any of its potentially constructed subojects is potentially throwing.
11.4.4 [special] paragraph 5 defines “potentially constructed subobjects” as follows:
For a class, its non-static data members, its non-virtual direct base classes, and, if the class is not abstract (11.7.4 [class.abstract]), its virtual base classes are called its potentially constructed subobjects.
This leads to the following problem:
class V { public: virtual ~V() noexcept(false); }; class B : virtual V { virtual void foo () = 0; // implicitly defined virtual ~B () noexcept(true); }; class D : B { virtual void foo (); // implicitly defined virtual ~D () noexcept(false); };
Here, D::~D() is throwing but overrides the non-throwing B::~B().
There are similar problems with the deletedness of destructors per 11.4.7 [class.dtor] paragraph 5, which also only considers potentially constructed subobjects.
History | |||
---|---|---|---|
Date | User | Action | Args |
2020-12-15 00:00:00 | admin | set | messages: + msg6426 |
2020-12-15 00:00:00 | admin | set | status: drafting -> cd5 |
2017-02-28 00:00:00 | admin | create |