Section: 184.108.40.206 [res.on.exception.handling] Status: New Submitter: Nevin Liber Opened: 2019-06-28 Last modified: 2023-01-29 11:23:47 UTC
View other active issues in [res.on.exception.handling].
View all other issues in [res.on.exception.handling].
View all issues with New status.
220.127.116.11 [res.on.exception.handling]#3 says:
Destructor operations defined in the C++ standard library shall not throw exceptions. Every destructor in the C++ standard library shall behave as if it had a non-throwing exception specification.
However, types like pair and array have implicitly declared destructors, where 14.5 [except.spec]#8 applies:
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 is potentially-throwing or the destructor is virtual and the destructor of any virtual base class is potentially throwing.
We can relax 18.104.22.168 [res.on.exception.handling] to only cover explicitly declared destructors because if they hold a user type where the destructor throws then we get UB from 22.214.171.124 [res.on.functions]#2:
In particular, the effects are undefined in the following cases: […]
(2.4) — if any replacement function or handler function or destructor operation exits via an exception, unless specifically allowed in the applicable Required behavior: paragraph.
and the referred to UB happens before [res.on.exception.handling] could apply.
[2019-07 Issue Prioritization]
Priority to 3 after discussion on the reflector.
[2023-01-29; Daniel comments]
This issue has very much overlap with LWG 3854.
This wording is relative to N4820.
Modify 126.96.36.199 [res.on.exception.handling] as indicated:
-3- Destructor operations defined in the C++ standard library shall not throw exceptions. Every destructor in the C++ standard library shall behave as if it had a non-throwing exception specification.