From Jason Turner

[class.free]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpv604ljl4/{from.md → to.md} +11 -3
tmp/tmpv604ljl4/{from.md → to.md} RENAMED
@@ -48,11 +48,13 @@ cannot be virtual.
48
  [*Note 1*:
49
 
50
  However, when the *cast-expression* of a *delete-expression* refers to
51
  an object of class type with a virtual destructor, because the
52
  deallocation function is chosen by the destructor of the dynamic type of
53
- the object, the effect is the same in that case. For example,
 
 
54
 
55
  ``` cpp
56
  struct B {
57
  virtual ~B();
58
  void operator delete(void*, std::size_t);
@@ -82,17 +84,21 @@ void f() {
82
  Here, storage for the object of class `D` is deallocated by
83
  `D::operator delete()`, and the object of class `E` is destroyed and its
84
  storage is deallocated by `E::operator delete()`, due to the virtual
85
  destructor.
86
 
 
 
87
  — *end note*]
88
 
89
  [*Note 2*:
90
 
91
  Virtual destructors have no effect on the deallocation function actually
92
  called when the *cast-expression* of a *delete-expression* refers to an
93
- array of objects of class type. For example,
 
 
94
 
95
  ``` cpp
96
  struct B {
97
  virtual ~B();
98
  void operator delete[](void*, std::size_t);
@@ -108,16 +114,18 @@ void f(int i) {
108
  B* bp = new D[i];
109
  delete[] bp; // undefined behavior
110
  }
111
  ```
112
 
 
 
113
  — *end note*]
114
 
115
  Access to the deallocation function is checked statically, even if a
116
  different one is actually executed.
117
 
118
- [*Example 3*: For the call on line “// 1” above, if
119
  `B::operator delete()` had been private, the delete expression would
120
  have been ill-formed. — *end example*]
121
 
122
  [*Note 3*: If a deallocation function has no explicit
123
  *noexcept-specifier*, it has a non-throwing exception specification
 
48
  [*Note 1*:
49
 
50
  However, when the *cast-expression* of a *delete-expression* refers to
51
  an object of class type with a virtual destructor, because the
52
  deallocation function is chosen by the destructor of the dynamic type of
53
+ the object, the effect is the same in that case.
54
+
55
+ [*Example 3*:
56
 
57
  ``` cpp
58
  struct B {
59
  virtual ~B();
60
  void operator delete(void*, std::size_t);
 
84
  Here, storage for the object of class `D` is deallocated by
85
  `D::operator delete()`, and the object of class `E` is destroyed and its
86
  storage is deallocated by `E::operator delete()`, due to the virtual
87
  destructor.
88
 
89
+ — *end example*]
90
+
91
  — *end note*]
92
 
93
  [*Note 2*:
94
 
95
  Virtual destructors have no effect on the deallocation function actually
96
  called when the *cast-expression* of a *delete-expression* refers to an
97
+ array of objects of class type.
98
+
99
+ [*Example 4*:
100
 
101
  ``` cpp
102
  struct B {
103
  virtual ~B();
104
  void operator delete[](void*, std::size_t);
 
114
  B* bp = new D[i];
115
  delete[] bp; // undefined behavior
116
  }
117
  ```
118
 
119
+ — *end example*]
120
+
121
  — *end note*]
122
 
123
  Access to the deallocation function is checked statically, even if a
124
  different one is actually executed.
125
 
126
+ [*Example 5*: For the call on line “// 1” above, if
127
  `B::operator delete()` had been private, the delete expression would
128
  have been ill-formed. — *end example*]
129
 
130
  [*Note 3*: If a deallocation function has no explicit
131
  *noexcept-specifier*, it has a non-throwing exception specification