Annex F (informative)
Core undefined behavior
[ub]
F.5
[dcl]
: Declarations
[ub.dcl]
F.5.2
[ub:dcl.type.cv.access.volatile]
Specified in:
[dcl.
type.
cv]
1
#
If an attempt is made to access an object defined with a volatile-qualified type through the use of a non-volatile glvalue, the behavior is undefined
2
#
[
Example
1
:
volatile
int
x
=
0
;
int
&
y
=
const_cast
<
int
&
>
(
x
)
; std
::
cout
<
<
y;
// undefined behavior, accessing volatile through non-volatile glvalue
—
end example
]