This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 113d. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2024-03-20


971. Incorrect treatment of exception-declarations

Section: 14.4  [except.handle]     Status: C++11     Submitter: Mike Miller     Date: 28 September, 2009

The current wording of 14.4 [except.handle] paragraph 16 is:

The object declared in an exception-declaration or, if the exception-declaration does not specify a name, a temporary (6.7.7 [class.temporary]) is copy-initialized (9.4 [dcl.init]) from the exception object. The object shall not have an abstract class type. The object is destroyed when the handler exits, after the destruction of any automatic objects initialized within the handler.

There are two problems with this. First, it's not clear what it means for the handler's “parameter” to be a temporary. This possibility is briefly mentioned in 6.7.7 [class.temporary], but the lifetime of such a temporary is not defined there; the discussion of lifetime is restricted to those temporaries that arise during the evaluation of an expression, and this is not such a case.

Second, this wording assumes that there will be an object to be destroyed and thus ignores the possibility that the exception-declaration declares a reference.

Proposed resolution (March, 2011):

This issue is resolved by the resolution of issue 1166 in paper N3262.