Title
Storage duration of exception objects
Status
drwp
Section
14.2 [except.throw]
Submitter
Jiang An

Created on 2024-01-22.00:00:00 last changed 5 months ago

Messages

Date: 2024-02-16.23:23:05

Proposed resolution (approved by CWG 2024-02-16):

  1. Change in 6.7.7 [class.temporary] paragraph 1 as follows:

    Temporary objects are created
    • when a prvalue is converted to an xvalue (7.3.5 [conv.rval]), and
    • when needed by the implementation to pass or return an object of trivially copyable type (see below), and.
    • when throwing an exception (14.2 [except.throw]). [Note 1: The lifetime of exception objects is described in 14.2 [except.throw]. —end note]
    ...
  2. Change in 14.2 [except.throw] paragraph 3 as follows:

    Throwing an exception initializes a temporary an object with dynamic storage duration, called the exception object. If the type of the exception object would be an incomplete type (6.8.1 [basic.types.general]), an abstract class type (11.7.4 [class.abstract]), or a pointer to an incomplete type other than cv void (6.8.4 [basic.compound]) the program is ill-formed.
Date: 2024-03-15.00:00:00

[Accepted as a DR at the March, 2024 meeting.]

(From submission #492.)

According to 14.2 [except.throw] paragraph 3, the exception object is a temporary object. But none of the possible storage durations of temporary objects matches the behavior of exception objects.

History
Date User Action Args
2024-07-20 13:52:34adminsetstatus: dr -> drwp
2024-04-05 21:43:46adminsetstatus: ready -> dr
2024-03-20 14:10:31adminsetstatus: tentatively ready -> ready
2024-02-16 23:23:05adminsetmessages: + msg7608
2024-02-16 23:23:05adminsetstatus: open -> tentatively ready
2024-01-22 00:00:00admincreate