This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 117b. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2025-08-11
1167. function-try-blocks for destructorsSection: 14.5 [except.spec] Status: C++11 Submitter: GB Date: 2010-08-03[Voted into the WP at the March, 2011 meeting.]
N3092 comment GB 46It is not entirely clear that a function-try-block on a destructor will catch exceptions from a base or member destructor; whether such exceptions might be swallowed with a simple return statement rather than being rethrown; and whether such a clause might be entered multiple times if multiple bases/members throw, or if that is an automatic terminate call.
Proposed resolution (August, 2010):
Change Clause 14 [except] paragraph 4 as follows:
...An exception thrown during the execution of the initializer expressions in the ctor-initializer or during the execution of the compound-statement , or β in the case of a destructor β during the destruction of a subobject, transfers control to a handler in a function-try-block in the same way as an exception thrown during the execution of a try-block transfers control to other handlers. [Example:...
Additional note (October, 2010):
There is a related problem with this wording: it covers only βthe execution of the initializer expressions in the ctor-initializer,β when it should also cover execution of base and member constructors, regardless of whether they have initializer expressions in the ctor-initializer or not.
The issue has been moved back to "review" status to allow consideration of amending the proposed resolution to something like
...during the execution of the compound-statement or, if the function is a constructor or destructor, during the initialization or destruction of the class's subobjects, transfers control...
Proposed resolution (November, 2010):
Change Clause 14 [except] paragraph 4 as follows:
A function-try-block associates a handler-seq with the ctor-initializer, if present, and the compound-statement. An exception thrown during the execution of the initializer expressions in the ctor-initializer or during the execution of thecompound-statement or, for constructors and destructors, during the initialization or destruction, respectively, of the class's subobjects, transfers control to a handler in a function-try-block in the same way as an exception thrown during the execution of a try-block transfers control to other handlers.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4