File tree Expand file tree Collapse file tree 2 files changed +23
-4
lines changed
Expand file tree Collapse file tree 2 files changed +23
-4
lines changed Original file line number Diff line number Diff line change 44234423signature.
44244424
44254425\pnum
4426- If a deallocation function terminates by throwing an exception, the behavior is undefined.\ubxref {basic.stc.alloc.dealloc.constraint.2 }
4426+ If a deallocation function terminates by throwing an exception, the behavior is undefined.\ubxref {basic.stc.alloc.dealloc.throw }
44274427The value of the first argument supplied to a deallocation function may
44284428be a null pointer value; if so, and if the deallocation function is one
44294429supplied in the standard library, the call has no effect.
Original file line number Diff line number Diff line change 262262
263263\pnum
264264\ubxref {basic.stc.alloc.dealloc.constraint } \\
265- % \ubxref{basic.stc.alloc.dealloc.constraint.2} \\
266265If the behavior of an allocation or deallocation function does not satisfy the semantic constraints
267266specified
268- in \iref {basic.stc.dynamic.allocation } and \iref {basic.stc.dynamic.deallocation },
269- including exiting via a thrown exception when not specified to do so,
267+ in \iref {basic.stc.dynamic.allocation } and \iref {basic.stc.dynamic.deallocation }.
270268the behavior is undefined.
271269
272270
287285\end {codeblock }
288286\end {example }
289287
288+ \pnum
289+ \ubxref {basic.stc.alloc.dealloc.throw } \\
290+ If a call to a deallocation function
291+ terminates by throwing an exception
292+ the behavior is undefined.
293+ \pnum
294+ \begin {example }
295+ \begin {codeblock }
296+ struct X {
297+ void operator delete(void*) { throw "oops" ; }
298+ };
299+ void f()
300+ {
301+ X* x = new X();
302+ delete x; // undefined behavior
303+ }
304+ \end {codeblock }
305+ \end {example }
306+
307+
308+
290309\rSec 2[ub.basic.stc.alloc.zero.dereference]{Zero-sized allocation dereference}
291310
292311\pnum
You can’t perform that action at this time.
0 commit comments