Title
Requirements on thrown object type to support std::current_exception()
Status
cd4
Section
18.1 [except.throw]
Submitter
Canada

Created on 2013-09-22.00:00:00 last changed 46 months ago

Messages

Date: 2015-10-15.00:00:00

[Moved to DR at the October, 2015 meeting.]

Date: 2015-05-15.00:00:00

Proposed resolution (May, 2015):

  1. Change 15.4 [class.dtor] paragraph 11 as follows:

  2. ...A destructor is potentially invoked if it is invoked or as specified in 8.3.4 [expr.new] and, 15.6.2 [class.base.init], and 18.1 [except.throw]. A program is ill-formed if...
  3. Change 18.1 [except.throw] paragraph 5 as follows:

  4. When the thrown object is a class object, the constructor selected for the copy-initialization as well as the constructor selected for a copy-initialization considering the thrown object as an lvalue and the destructor shall be non-deleted and accessible, even if the copy/move operation is elided (15.8 [class.copy]). The destructor is potentially invoked (15.4 [class.dtor]).
Date: 2014-03-03.00:00:00

Additional note, February, 2014:

This issue was referred to CWG by EWG at the September, 2013 meeting but was overlooked at that time.

Date: 2013-09-22.00:00:00
N3690 comment CA 12

The specification of std::current_exception() in 21.8.6 [propagation] allows either referring to the exception object itself or to a copy thereof, implying that the exception object must be copyable. However, the specification of throw-expression allows throwing objects that cannot be copied, only moved. Presumably the requirements should include a non-deleted accessible copy constructor that is odr-used by a throw-expression, even if the object being thrown is moved to the exception object.

History
Date User Action Args
2017-02-06 00:00:00adminsetstatus: dr -> cd4
2015-11-10 00:00:00adminsetmessages: + msg6083
2015-11-10 00:00:00adminsetstatus: ready -> dr
2015-05-25 00:00:00adminsetmessages: + msg5468
2015-05-25 00:00:00adminsetstatus: drafting -> ready
2014-11-24 00:00:00adminsetstatus: open -> drafting
2014-03-03 00:00:00adminsetmessages: + msg4921
2013-09-22 00:00:00admincreate