Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[expr.delete] p2 The restriction on operand of a single-object delete expression #4853

Closed
xmh0511 opened this issue Sep 1, 2021 · 0 comments · Fixed by #4859
Closed

[expr.delete] p2 The restriction on operand of a single-object delete expression #4853

xmh0511 opened this issue Sep 1, 2021 · 0 comments · Fixed by #4859
Assignees

Comments

@xmh0511
Copy link
Contributor

xmh0511 commented Sep 1, 2021

In a single-object delete expression, the value of the operand of delete may be a null pointer value, a pointer to a non-array object created by a previous new-expression, or a pointer to a subobject representing a base class of such an object. If not, the behavior is undefined.

Which previous new-expression does the rule refer to? Presumably, it shall be a new-expression that allocated an object of non-class type. Hence, the above rule should be that

In a single-object delete expression, the value of the operand of delete may be a null pointer value, a pointer to a non-array object created by a previous new-expression that allocated an object of non-class type, or a pointer to a subobject representing a base class of such an object. If not, the behavior is undefined.

Since we although said "a pointer to a non-array object", however, it is not sufficient, a pointer to an initial element of an array is also considered as "a pointer to a non-array object "

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants