Annex F (informative)
Core undefined behavior
[ub]
F.2
[basic]
: Basics
[ub.basic]
F.2.16
[ub:basic.stc.alloc.zero.dereference]
Specified in:
[basic.
stc.
dynamic.
allocation]
1
#
The pointer returned when invoking an allocation function with a size of zero cannot be dereferenced
.
2
#
[
Example
1
:
void
test
(
)
{
char
*
c
=
static_cast
<
char
*
>
(
operator
new
(
0z
)
)
; c
[
0
]
=
'X'
;
// undefined behavior
}
—
end example
]