From 4.1/2
The value contained in the object indicated by the lvalue is the
rvalue result. When an lvalue-to-rvalue conversion occurs within the
operand of sizeof (5.3.3) the value contained in the referenced object
is not accessed, since that operator does not evaluate its operand.
Out of curiosity, I was wondering, does the same applies to the if, for, while statements, i.e lvalue is converted to rvalue when the result of statement is evaluated?
Yes. Without
lvalue-to-rvalueconversion, it cannot read it’s value.Loosely speaking, think of lvalue as some sort of container, and rvalue as the value contained in the container.
C++03, section §3.10/7 reads,
Read it along with, §4.1/2 (your quotation),
Related topic: