Title
Unclear argument type for copy of exception object
Status
tentatively ready
Section
14.2 [except.throw]
Submitter
Jiang An

Created on 2023-05-31.00:00:00 last changed 5 days ago

Messages

Date: 2023-09-15.21:51:11

Proposed resolution (approved by CWG 2023-09-15):

Change in 14.2 [except.throw] paragraph 5 as follows:

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 shall be non-deleted and accessible, even if the copy/move operation is elided (11.9.6 [class.copy.elision]). Let T denote the type of the exception object. Copy-initialization of an object of type T from an lvalue of type const T in a context unrelated to any class shall be well-formed. If T is a class type, The the destructor of T is potentially invoked (11.4.7 [class.dtor]).
Date: 2023-09-15.21:51:11

Subclause 14.2 [except.throw] paragraph 5 specifies:

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 shall be non-deleted and accessible, even if the copy/move operation is elided (11.9.6 [class.copy.elision]). The destructor is potentially invoked (11.4.7 [class.dtor]).

This provision is for capturing a copy constructor for implementations not using reference-counted std::exception_ptrs, but that ought to be described separately from the "thrown object", which can be interpreted as the operand of the throw-expression.

History
Date User Action Args
2023-09-15 21:51:11adminsetmessages: + msg7431
2023-09-15 21:51:11adminsetstatus: open -> tentatively ready
2023-05-31 00:00:00admincreate