|
4136 | 4136 | \terminal{::}\opt{} \terminal{delete [ ]} cast-expression
|
4137 | 4137 | \end{bnf}
|
4138 | 4138 |
|
4139 |
| -The first alternative is for non-array objects, and the second is for arrays. Whenever |
4140 |
| -the \tcode{delete} keyword is immediately followed by empty square brackets, it shall be |
4141 |
| -interpreted as the second alternative.\footnote{A lambda expression with a |
4142 |
| -\grammarterm{lambda-introducer} that consists of |
4143 |
| -empty square brackets can follow the \tcode{delete} keyword if the lambda expression is |
| 4139 | +The first alternative is a |
| 4140 | +\defnx{single-object delete expression}{delete!single-object}, and the |
| 4141 | +second is an \defnx{array delete expression}{delete!array}. |
| 4142 | +Whenever the \tcode{delete} keyword is immediately followed by empty square |
| 4143 | +brackets, it shall be interpreted as the second alternative.\footnote{A lambda |
| 4144 | +expression with a \grammarterm{lambda-introducer} that consists of empty square |
| 4145 | +brackets can follow the \tcode{delete} keyword if the lambda expression is |
4144 | 4146 | enclosed in parentheses.}
|
4145 | 4147 | The operand shall be of pointer to object type or of class type. If of
|
4146 | 4148 | class type, the operand is contextually implicitly converted\iref{conv}
|
|
4152 | 4154 | \tcode{void}.
|
4153 | 4155 |
|
4154 | 4156 | \pnum
|
4155 |
| -\indextext{\idxcode{delete}!object}% |
| 4157 | +\indextext{\idxcode{delete}!single-object}% |
4156 | 4158 | If the operand has a class type, the operand is converted to a pointer
|
4157 | 4159 | type by calling the above-mentioned conversion function, and the
|
4158 | 4160 | converted operand is used in place of the original operand for the
|
4159 | 4161 | remainder of this subclause.
|
4160 |
| -In the first alternative |
4161 |
| -(\defnx{delete object}{object!delete}), the value of the operand of \tcode{delete} may |
4162 |
| -be a null pointer value, a pointer to a non-array object |
| 4162 | +In a single-object delete expression, the value of the operand of |
| 4163 | +\tcode{delete} may be a null pointer value, a pointer to a non-array object |
4163 | 4164 | created by a previous \grammarterm{new-expression},
|
4164 | 4165 | or a pointer to a
|
4165 | 4166 | subobject\iref{intro.object} representing a base class of such an
|
4166 | 4167 | object\iref{class.derived}. If not, the behavior is undefined.
|
4167 | 4168 | \indextext{array!\idxcode{delete}}%
|
4168 |
| -In the second alternative (\defnx{delete array}{\idxcode{delete}!array}), the value of the |
4169 |
| -operand of \tcode{delete} |
4170 |
| -may be a null pointer value or a pointer value |
4171 |
| -that resulted from |
| 4169 | +In an array delete expression, the value of the operand of \tcode{delete} |
| 4170 | +may be a null pointer value or a pointer value that resulted from |
4172 | 4171 | a previous array \grammarterm{new-expression}.\footnote{For nonzero-length
|
4173 | 4172 | arrays, this is the same as a pointer to the first
|
4174 | 4173 | element of the array created by that \grammarterm{new-expression}.
|
|
4188 | 4187 |
|
4189 | 4188 | \pnum
|
4190 | 4189 | \indextext{\idxcode{delete}!undefined}%
|
4191 |
| -In the first alternative (\term{delete object}), if the static type of |
4192 |
| -the object to be deleted is different from its dynamic type, the static type shall be |
4193 |
| -a base class of the dynamic type of the object to be deleted and the static type shall |
4194 |
| -have a virtual destructor or the behavior is undefined. In the second |
4195 |
| -alternative (\term{delete array}) if the dynamic type of the object to |
4196 |
| -be deleted differs from its static type, the behavior is undefined. |
| 4190 | +In a single-object delete expression, if the static type of the object to be |
| 4191 | +deleted is different from its dynamic type, the static type shall be a base |
| 4192 | +class of the dynamic type of the object to be deleted and the static type shall |
| 4193 | +have a virtual destructor or the behavior is undefined. In an array delete |
| 4194 | +expression, if the dynamic type of the object to be deleted differs from its |
| 4195 | +static type, the behavior is undefined. |
4197 | 4196 |
|
4198 | 4197 | \pnum
|
4199 | 4198 | The \grammarterm{cast-expression} in a \grammarterm{delete-expression} shall
|
|
4298 | 4297 | \pnum
|
4299 | 4298 | When a \grammarterm{delete-expression}
|
4300 | 4299 | is executed, the selected deallocation function shall be called with
|
4301 |
| -the address of the most-derived object in the \term{delete object} case, or |
4302 |
| -the address of the object suitably adjusted for |
4303 |
| -the array allocation overhead\iref{expr.new} in the \term{delete array} case, |
| 4300 | +the address of the most-derived object in a single-object delete expression, or |
| 4301 | +the address of the object suitably adjusted for the array allocation |
| 4302 | +overhead\iref{expr.new} in an array delete expression, |
4304 | 4303 | as its first argument.
|
4305 | 4304 | If a deallocation function
|
4306 | 4305 | with a parameter of type \tcode{std::align_val_t}
|
|
0 commit comments