Title
Evaluation of conversions in a delete-expression
Status
tentatively ready
Section
7.6.2.9 [expr.delete]
Submitter
Jiang An

Created on 2023-05-05.00:00:00 last changed 2 months ago

Messages

Date: 2024-03-20.04:45:01

Proposed resolution (approved by CWG 2024-03-20):

  1. Change in 7.6.2.9 [expr.delete] paragraph 1 and paragraph 2 as follows:

    ... The first alternative is a single-object delete expression, and the second is an array delete expression. Whenever the delete keyword is immediately followed by empty square brackets, it shall be interpreted as the second alternative. [ Footnote: ... ] If the operand is of class type, it is contextually implicitly converted (7.3 [conv]) to a pointer to object type and the converted operand is used in place of the original operand for the remainder of this subclause. [ Footnote: ...] Otherwise, it shall be a prvalue of pointer to object type. The delete-expression has type void.

    If the operand has a class type, the operand is converted to a pointer type by calling the above-mentioned conversion function, and the converted operand is used in place of the original operand for the remainder of this subclause. ...

  2. Delete 7.6.2.9 [expr.delete] paragraph 4:

    The cast-expression in a delete-expression shall be evaluated exactly once.
Date: 2024-03-20.02:38:50

Proposed resolution (approved by CWG 2024-03-01) [SUPERSEDED]:

  1. Change in 7.6.2.9 [expr.delete] paragraph 1 and paragraph 2 as follows:

    ... The operand shall be of class type or a prvalue of pointer to object type or of class type. If of class type, the operand is contextually implicitly converted (7.3 [conv]) to a prvalue pointer to object type. [ Footnote: ... ] The converted operand is used in place of the original operand for the remainder of this subclause. The delete-expression has type void.

    If the operand has a class type, the operand is converted to a pointer type by calling the above-mentioned conversion function, and the converted operand is used in place of the original operand for the remainder of this subclause. ...

  2. Change in 7.6.2.9 [expr.delete] paragraph 4 as follows:

    The cast-expression in operand of a delete-expression shall be evaluated exactly once.
Date: 2024-03-03.21:57:08

Subclause 7.6.2.9 [expr.delete] paragraph 4 specifies:

The cast-expression in a delete-expression shall be evaluated exactly once.

Due to the reference to the syntactic non-terminal cast-expression, it is unclear whether that includes the conversion to pointer type specified in 7.6.2.9 [expr.delete] paragraph 2.

History
Date User Action Args
2024-03-20 02:38:50adminsetmessages: + msg7645
2024-03-03 21:57:08adminsetmessages: + msg7624
2024-03-03 21:57:08adminsetstatus: open -> tentatively ready
2023-05-05 00:00:00admincreate