Annex F (informative)
Core undefined behavior
[ub]
F.5
[dcl]
: Declarations
[ub.dcl]
F.5.1
[ub:dcl.type.cv.modify.const.obj]
Specified in:
[dcl.
type.
cv]
1
#
Any attempt to modify a const object during its lifetime results in undefined behavior
.
2
#
[
Example
1
:
const
int
*
ciq
=
new
const
int
(
3
)
;
// initialized as required
int
*
iq
=
const_cast
<
int
*
>
(
ciq
)
;
// cast required
*
iq
=
4
;
// undefined behavior, modifies a const object
—
end example
]