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] destructor invoked for null pointer values? #1820

Closed
brevzin opened this issue Nov 17, 2017 · 2 comments
Closed

[expr.delete] destructor invoked for null pointer values? #1820

brevzin opened this issue Nov 17, 2017 · 2 comments

Comments

@brevzin
Copy link
Contributor

brevzin commented Nov 17, 2017

[expr.delete]/6 currently reads:

If the value of the operand of the delete-expression is not a null pointer value, the delete-expression will invoke the destructor (if any) for the object or the elements of the array being deleted.

This doesn't actually say whether or not the destructor is invoked if the operand is a null pointer value. That can be corrected with just 3 more words:

If , and only if, the value of the operand of the delete-expression is not a null pointer value, the delete-expression will invoke the destructor (if any) for the object or the elements of the array being deleted.

I don't think there's any question that this is the intended behavior.

@tkoeppe
Copy link
Contributor

tkoeppe commented Nov 18, 2017

I think the "only if" part follows from a more general principle that we don't usually have to specify the absence of behaviour. Otherwise, why doesn't vector::empty say "does not exit the program"?

@brevzin
Copy link
Contributor Author

brevzin commented Nov 18, 2017

That... is a good point. I'll just close the issue as pointless?

@brevzin brevzin closed this as completed Nov 18, 2017
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

No branches or pull requests

2 participants