Title
Source for copy-initializing the exception object
Status
drwp
Section
7.6.18 [expr.throw]
Submitter
Brian Bi

Created on 2023-03-26.00:00:00 last changed 4 months ago

Messages

Date: 2023-03-31.21:41:42

Proposed resolution (approved by CWG 2023-03-30):

  1. Change in 7.6.18 [expr.throw] paragraph 2 as follows:

    Evaluating a throw-expression with an operand throws an exception (14.2 [except.throw]); the type of the exception object is determined by removing any top-level cv-qualifiers from the static type of the operand and adjusting the type from “array of T” or function type T to “pointer to T”. The exception object is copy-initialized (9.4.1 [dcl.init.general]) from the operand.
  2. Change in 14.2 [except.throw] paragraph 3 as follows:

    Throwing an exception copy-initializes (9.4 [dcl.init], 11.4.5.3 [class.copy.ctor]) a temporary object, 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: 2023-06-15.00:00:00

[Accepted as a DR at the June, 2023 meeting.]

Neither 14.2 [except.throw] nor 7.6.18 [expr.throw] specifiy the source for copy-initializing the exception object.

Proposed resolution (based on the resolution of issue 2699; approved by CWG 2023-06-12):

  1. Change in 7.6.18 [expr.throw] paragraph 2 as follows:

    Evaluating a throw-expression with an operand throws an exception (14.2 [except.throw]); the type of the exception object is determined by removing any top-level cv-qualifiers from the static type of the operand and adjusting the type from “array of T” or function type T to “pointer to T”. The exception object is copy-initialized (9.4.1 [dcl.init.general]) from the (possibly converted) operand.
  2. Change in 14.2 [except.throw] paragraph 3 as follows:

    Throwing an exception copy-initializes (9.4 [dcl.init], 11.4.5.3 [class.copy.ctor]) a temporary object, 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.
History
Date User Action Args
2023-12-19 10:15:28adminsetstatus: dr -> drwp
2023-07-16 13:00:43adminsetstatus: ready -> dr
2023-03-31 21:41:42adminsetmessages: + msg7241
2023-03-31 21:41:42adminsetstatus: open -> ready
2023-03-26 00:00:00admincreate