For a single-object delete expression,
the deleted object is
the object
A pointed to by the operand
if the static type of
A does not have a virtual destructor,
and the most-derived object of
A otherwise
. [
Note 6:
If the deallocation function is not a destroying operator delete
and the deleted object is not the most derived object in the former case,
the behavior is undefined,
as stated above
. —
end note]
For an array delete expression,
the deleted object is
the array object
. When a
delete-expression
is executed, the selected deallocation function shall be called with
the address of the deleted object
in a single-object delete expression, or
the address of the deleted object
suitably adjusted for the array allocation
overhead (
[expr.new]) in an array delete expression,
as its first argument
. [
Note 7:
Any cv-qualifiers in the type of the deleted object
are ignored when forming this argument
. —
end note]
If a destroying operator delete is used,
an unspecified value
is passed as the argument
corresponding to the parameter of type
std::destroying_delete_t. If a deallocation function
with a parameter of type
std::align_val_t
is used,
the alignment of the type of the deleted object
is passed as the corresponding argument
. If a deallocation function
with a parameter of type
std::size_t is used,
the size of the deleted object
in a single-object delete expression, or
of the array plus allocation overhead
in an array delete expression,
is passed as the corresponding argument
. [
Note 8:
If this results in a call to a replaceable deallocation function,
and either
the first argument was not the result of
a prior call to a replaceable allocation function or
the second or third argument was not the corresponding argument in said call,
the behavior is undefined (
[new.delete.single],
[new.delete.array])
. —
end note]