[conv.lval] (original) (raw)

7 Expressions [expr]

7.3 Standard conversions [conv]

7.3.2 Lvalue-to-rvalue conversion [conv.lval]

A glvalue of a non-function, non-array type Tcan be converted to a prvalue.43

If T is an incomplete type, a program that necessitates this conversion is ill-formed.

If Tis a non-class type, the type of the prvalue is the cv-unqualified version of T.

Otherwise, the type of the prvalue is T.44

When an lvalue-to-rvalue conversion is applied to an expression E, and either

the value contained in the referenced object is not accessed.

[Example 1: struct S { int n; };auto f() {S x { 1 };constexpr S y { 2 };return [&](bool b) { return (b ? y : x).n; };} auto g = f();int m = g(false); int n = g(true); — _end example_]

The result of the conversion is determined according to the following rules: