Title
Incorrect treatment of exception-declarations
Status
c++11
Section
14.4 [except.handle]
Submitter
Mike Miller

Created on 2009-09-28.00:00:00 last changed 122 months ago

Messages

Date: 2011-03-15.00:00:00

Proposed resolution (March, 2011):

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

Date: 2009-09-28.00:00:00

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.

History
Date User Action Args
2014-03-03 00:00:00adminsetstatus: fdis -> c++11
2011-04-10 00:00:00adminsetmessages: + msg3404
2011-04-10 00:00:00adminsetstatus: open -> fdis
2009-09-28 00:00:00admincreate