[expr.type] (original) (raw)

7 Expressions [expr]

7.2 Properties of expressions [expr.prop]

7.2.2 Type [expr.type]

If an expression initially has the type “reference toT” ([dcl.ref], [dcl.init.ref]), the type is adjusted toT prior to any further analysis; the value category of the expression is not altered.

Let X be the object or function denoted by the reference.

If a pointer to X would be valid in the context of the evaluation of the expression ([basic.fundamental]), the result designates X; otherwise, the behavior is undefined.

[Note 1:

Before the lifetime of the reference has started or after it has ended, the behavior is undefined (see [basic.life]).

— _end note_]

If a prvalue initially has the type “cv T”, whereT is a cv-unqualified non-class, non-array type, the type of the expression is adjusted to T prior to any further analysis.

The composite pointer type of two operands p1 andp2 having types T1 and T2, respectively, where at least one is a pointer or pointer-to-member type orstd​::​nullptr_t, is:

[Example 1: typedef void *p;typedef const int *q;typedef int **pi;typedef const int **pci;

The composite pointer type of p and q is “pointer to const void”; the composite pointer type of pi and pci is “pointer to const pointer toconst int”.

— _end example_]