File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change 674
674
pointer value\iref {basic.stc.dynamic.deallocation }, the behavior is
675
675
\impldef {lvalue-to-rvalue conversion of an invalid pointer value}.
676
676
677
+ \item Otherwise, if the bits in the value representation of
678
+ the object to which the glvalue refers
679
+ are not valid for the object's type, the behavior is undefined.
680
+ \begin {example }
681
+ \begin {codeblock }
682
+ bool f() {
683
+ bool b = true;
684
+ char c = 42;
685
+ memcpy(&b, &c, 1);
686
+ return b; // undefined behavior if \tcode {42} is not a valid value representation for \keyword {bool}
687
+ }
688
+ \end {codeblock }
689
+ \end {example }
690
+
677
691
\item Otherwise, the object indicated by the glvalue is read\iref {defns.access },
678
692
and the value contained in the object is the prvalue result.
679
- If the result is an erroneous value\iref {basic.indet } and
680
- the bits in the value representation are not valid for the object's type,
681
- the behavior is undefined.
682
693
\end {itemize }
683
694
684
695
\pnum
You can’t perform that action at this time.
0 commit comments