Title
Incorrect use of null pointer constant in description of delete operator
Status
cd1
Section
7.6.2.9 [expr.delete]
Submitter
Matthias Hofmann

Created on 2003-12-02.00:00:00 last changed 26 months ago

Messages

Date: 2005-10-15.00:00:00

[Voted into WP at October 2005 meeting.]

Date: 2005-10-15.00:00:00

[Voted into WP at October 2005 meeting.]

Date: 2005-04-15.00:00:00

Proposed resolution (April, 2005):

This issue is resolved by the resolution of issue 348.

Date: 2004-10-15.00:00:00

Notes from October 2004 meeting:

This wording is superseded by, and this issue will be resolved by, the resolution of issue 348.

Date: 2022-11-20.07:54:16

After some discussion in comp.lang.c++.moderated we came to the conclusion that there seems to be a defect in 7.6.2.9 [expr.delete]/4, which says:

The cast-expression in a delete-expression shall be evaluated exactly once. If the delete-expression calls the implementation deallocation function (3.7.3.2), and if the operand of the delete expression is not the null pointer constant, the deallocation function will deallocate the storage referenced by the pointer thus rendering the pointer invalid. [Note: the value of a pointer that refers to deallocated storage is indeterminate. ]

In the second sentence, the term "null pointer constant" should be changed to "null pointer". In its present form, the passage claims that the deallocation function will deallocate the storage refered to by a null pointer that did not come from a null pointer constant in the delete expression. Besides, how can the null pointer constant be the operand of a delete expression, as "delete 0" is an error because delete requires a pointer type or a class type having a single conversion function to a pointer type?

See also issue 348.

Proposed resolution:

Change the indicated sentence of 7.6.2.9 [expr.delete] paragraph 4 as follows:

If the delete-expression calls the implementation deallocation function (6.7.5.5.3 [basic.stc.dynamic.deallocation]), and if the value of the operand of the delete expression is not the a null pointer constant, the deallocation function will deallocate the storage referenced by the pointer thus rendering the pointer invalid.
History
Date User Action Args
2022-02-18 07:47:23adminsetmessages: + msg6694
2008-10-05 00:00:00adminsetstatus: wp -> cd1
2006-04-22 00:00:00adminsetstatus: dr -> wp
2005-10-22 00:00:00adminsetmessages: + msg1275
2005-10-22 00:00:00adminsetstatus: ready -> dr
2005-05-01 00:00:00adminsetmessages: + msg1136
2005-05-01 00:00:00adminsetstatus: review -> ready
2004-11-07 00:00:00adminsetmessages: + msg1055
2004-04-09 00:00:00adminsetstatus: open -> review
2003-12-02 00:00:00admincreate