tmp/tmpg2krrzxk/{from.md → to.md}
RENAMED
|
@@ -22,28 +22,23 @@ void foo(int i) {
|
|
| 22 |
When an object is deleted with a *delete-expression* ([[expr.delete]]),
|
| 23 |
a *deallocation function* (`operator delete()` for non-array objects or
|
| 24 |
`operator delete[]()` for arrays) is (implicitly) called to reclaim the
|
| 25 |
storage occupied by the object ([[basic.stc.dynamic.deallocation]]).
|
| 26 |
|
| 27 |
-
|
| 28 |
-
deallocation function
|
| 29 |
-
the *delete-expression* is used to deallocate a class object whose
|
| 30 |
static type has a virtual destructor, the deallocation function is the
|
| 31 |
one selected at the point of definition of the dynamic type’s virtual
|
| 32 |
-
destructor ([[class.dtor]]).[^
|
| 33 |
is used to deallocate an object of class `T` or array thereof, the
|
| 34 |
static and dynamic types of the object shall be identical and the
|
| 35 |
deallocation function’s name is looked up in the scope of `T`. If this
|
| 36 |
-
lookup fails to find the name,
|
| 37 |
-
|
| 38 |
-
the lookup selects a placement deallocation
|
| 39 |
-
ill-formed.
|
| 40 |
-
|
| 41 |
-
When a *delete-expression* is executed, the selected deallocation
|
| 42 |
-
function shall be called with the address of the block of storage to be
|
| 43 |
-
reclaimed as its first argument and (if the two-parameter style is used)
|
| 44 |
-
the size of the block as its second argument.[^3]
|
| 45 |
|
| 46 |
Any deallocation function for a class `X` is a static member (even if
|
| 47 |
not explicitly declared `static`).
|
| 48 |
|
| 49 |
``` cpp
|
|
|
|
| 22 |
When an object is deleted with a *delete-expression* ([[expr.delete]]),
|
| 23 |
a *deallocation function* (`operator delete()` for non-array objects or
|
| 24 |
`operator delete[]()` for arrays) is (implicitly) called to reclaim the
|
| 25 |
storage occupied by the object ([[basic.stc.dynamic.deallocation]]).
|
| 26 |
|
| 27 |
+
Class-specific deallocation function lookup is a part of general
|
| 28 |
+
deallocation function lookup ([[expr.delete]]) and occurs as follows.
|
| 29 |
+
If the *delete-expression* is used to deallocate a class object whose
|
| 30 |
static type has a virtual destructor, the deallocation function is the
|
| 31 |
one selected at the point of definition of the dynamic type’s virtual
|
| 32 |
+
destructor ([[class.dtor]]).[^3] Otherwise, if the *delete-expression*
|
| 33 |
is used to deallocate an object of class `T` or array thereof, the
|
| 34 |
static and dynamic types of the object shall be identical and the
|
| 35 |
deallocation function’s name is looked up in the scope of `T`. If this
|
| 36 |
+
lookup fails to find the name, general deallocation function lookup (
|
| 37 |
+
[[expr.delete]]) continues. If the result of the lookup is ambiguous or
|
| 38 |
+
inaccessible, or if the lookup selects a placement deallocation
|
| 39 |
+
function, the program is ill-formed.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
|
| 41 |
Any deallocation function for a class `X` is a static member (even if
|
| 42 |
not explicitly declared `static`).
|
| 43 |
|
| 44 |
``` cpp
|