You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For a single-object delete expression, the deleted object is the object denoted by the operand if its static type does not have a virtual destructor, and its most-derived object otherwise.
auto ptr = newint;
delete ptr;
The operand of the delete-expression is an unqualified-id ptr, the object denoted by the ptr is the object named ptr (rather than the object pointed by ptr), as per [expr.prim.id.unqual#3] and [basic#pre-5]
The result is the entity denoted by the unqualified-id ([basic.lookup.unqual]).
An entity E is denoted by the name (if any) that is introduced by a declaration of E or by a typedef-name introduced by a declaration specifying E.
The expected object in this sentence should be the object pointed by the operand. The original operand of a delete-expression could be of pointer type or class type, but, in either case, the ultimate operand shall have pointer type. So, I think in this sentence, change "the object denoted by the operand" to
the object pointed by the value of the operand.
might be a more precise utterance.
The text was updated successfully, but these errors were encountered:
And I don't think you need "the value of the operand". It's fine to say that a pointer points to something, we don't need to talk about the value of the pointer.
So "the object pointed to by the operand", or "the object the operand points to" seem OK to me.
@jwakely Why I use the value of the operand has been discussed in #4662 (comment), we should explicitly specify the meaning. In addition, the value of the operand also implies lvalue-to-rvalue conversion may apply to the operand(if necessary).
I don't like adding extra words to "clarify" something that is not ambiguous. "The object pointed to by p" is obviously talking about the pointer value of p, not the type of p, because a type doesn't point to an object.
i.e. in cases like this, we already clearly differentiate between "pointer type" and "a value of pointer type".
It seems that the meaning of "the object pointed to by the operand" is clear. How about the lvalue-to-rvalue implied by "the value of..."? After all, the coversion is under-specified in many section in [expr] that should be specified.
[expr.delete#11]
The operand of the delete-expression is an unqualified-id
ptr
, the object denoted by theptr
is the object namedptr
(rather than the object pointed byptr
), as per [expr.prim.id.unqual#3] and [basic#pre-5]The expected object in this sentence should be the object pointed by the operand. The original operand of a delete-expression could be of pointer type or class type, but, in either case, the ultimate operand shall have pointer type. So, I think in this sentence, change "the object denoted by the operand" to
might be a more precise utterance.
The text was updated successfully, but these errors were encountered: