Lvalue-to-Rvalue Conversions

If an lvalue appears in a situation in which the compiler expects an rvalue, the compiler converts the lvalue to an rvalue.

An lvalue e of a type T can be converted to an rvalue if T is not a function or array type. The type of e after conversion will be T. The following table lists exceptions to this:

Situation before conversion Resulting behavior
T is an incomplete type compile-time error
e refers to an uninitialized object undefined behavior
e refers to an object not of type T undefined behavior
C++ e refers to an object not of type T, nor a type derived from T
undefined behavior
C++ T is a nonclass type
the type of e after conversion is T, not qualified by either const or volatile

Related References

IBM Copyright 2003