[expr.type]

# 7 Expressions [[expr]](./#expr)

## 7.2 Properties of expressions [[expr.prop]](expr.prop#expr.type)

### 7.2.2 Type [expr.type]

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/expressions.tex#L335)

If an expression initially has the type âreference toTâ ([[dcl.ref]](dcl.ref "9.3.4.3 References"), [[dcl.init.ref]](dcl.init.ref "9.5.4 References")), the type is adjusted toT prior to any further analysis;
the value category of the expression is not altered[.](#1.sentence-1)

Let X be the object or function denoted by the reference[.](#1.sentence-2)

If a pointer to X would be valid in
the context of the evaluation of the expression ([[basic.fundamental]](basic.fundamental "6.9.2 Fundamental types")),
the result designates X;
otherwise, the behavior is undefined[.](#1.sentence-3)

[*Note [1](#note-1)*:

Before the lifetime of the reference has started or after it has ended,
the behavior is undefined (see [[basic.life]](basic.life "6.8.4 Lifetime"))[.](#1.sentence-4)

â *end note*]

[2](#2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/expressions.tex#L351)

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[.](#2.sentence-1)

[3](#3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/expressions.tex#L356)

The [*composite pointer type*](#def:composite_pointer_type "7.2.2 Type [expr.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:

- [(3.1)](#3.1)

if both p1 and p2 are null pointer constants,std​::​nullptr_t;

- [(3.2)](#3.2)

if either p1 or p2 is a null pointer constant, T2 or T1,
respectively;

- [(3.3)](#3.3)

if T1 or T2 is âpointer to *cv1* voidâ and the
other type is âpointer to *cv2* Tâ,
where T is an object type or void,
âpointer to *cv12* voidâ,
where *cv12* is the union of *cv1* and *cv2*;

- [(3.4)](#3.4)

if T1 or T2 is âpointer to noexcept functionâ and the
other type is âpointer to functionâ, where the function types are otherwise the same,
âpointer to functionâ;

- [(3.5)](#3.5)

if T1 is âpointer to C1â and T2 is âpointer toC2â, where C1 is reference-related to C2 or C2 is
reference-related to C1 ([[dcl.init.ref]](dcl.init.ref "9.5.4 References")),
the qualification-combined type ([[conv.qual]](conv.qual "7.3.6 Qualification conversions"))
of T1 and T2 or the qualification-combined type of T2 and T1,
respectively;

- [(3.6)](#3.6)

if T1 or T2 is
âpointer to member of C1 of type functionâ,
the other type is
âpointer to member of C2 of type noexcept functionâ, andC1 is reference-related to C2 orC2 is reference-related to C1 ([[dcl.init.ref]](dcl.init.ref "9.5.4 References")),
where the function types are otherwise the same,
âpointer to member of C2 of type functionâ or
âpointer to member of C1 of type functionâ, respectively;

- [(3.7)](#3.7)

if T1 is
âpointer to member of C1 of type *cv1* Uâ andT2 is
âpointer to member of C2 of type *cv2* Uâ,
for some non-function type U,
where C1 is
reference-related to C2 or C2 is reference-related toC1 ([[dcl.init.ref]](dcl.init.ref "9.5.4 References")), the qualification-combined type of T2 and T1 or the qualification-combined type
of T1 and T2, respectively;

- [(3.8)](#3.8)

if T1 and T2 are similar types ([[conv.qual]](conv.qual "7.3.6 Qualification conversions")), the qualification-combined type of T1 andT2;

- [(3.9)](#3.9)

otherwise, a program that necessitates the determination of a
composite pointer type is ill-formed[.](#3.sentence-1)

[*Example [1](#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â[.](#3.sentence-2)

â *end example*]
