Lvalue-to-rvalue conversions
If an lvalue
or xvalue
is used in a situation
in which the compiler expects a
(prvalue)
rvalue, the compiler
converts the lvalue
or xvalue
to a
(prvalue)
rvalue.
However, a
(prvalue)
rvalue
cannot be converted implicitly to an lvalue
or xvalue
,
except by user-defined
conversions
. The following table lists exceptions to this rule.
or xvalue
is used in a situation
in which the compiler expects a
(prvalue)
rvalue, the compiler
converts the lvalue
or xvalue
to a
(prvalue)
rvalue.
However, a
(prvalue)
rvalue
cannot be converted implicitly to an lvalue
or xvalue
,
except by user-defined
conversions
. The following table lists exceptions to this rule. | Situation before conversion | Resulting behavior |
|---|---|
| The lvalue is a function type. | A pointer to function |
| The lvalue is an array. | A pointer to the first element of the array |
The type of the lvalue or xvalue is an incomplete type. |
compile-time error |
The lvalue or xvalue refers to an uninitialized
object. |
undefined behavior |
The lvalue or xvalue refers to an object
not of the type of the (prvalue) rvalue, nor of a
type derived from the type of the (prvalue) rvalue. |
undefined behavior |
The lvalue or xvalue is a nonclass type,
qualified by either const or volatile.![]() |
The type after conversion is not qualified by either const or volatile. |


