101 lines
4.4 KiB
Markdown
101 lines
4.4 KiB
Markdown
[expr.context]
|
||
|
||
# 7 Expressions [[expr]](./#expr)
|
||
|
||
## 7.2 Properties of expressions [[expr.prop]](expr.prop#expr.context)
|
||
|
||
### 7.2.3 Context dependence [expr.context]
|
||
|
||
[1](#1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/expressions.tex#L438)
|
||
|
||
In some contexts, [*unevaluated operands*](#def:unevaluated_operand "7.2.3 Context dependence [expr.context]") appear ([[expr.prim.req.simple]](expr.prim.req.simple "7.5.8.2 Simple requirements"), [[expr.prim.req.compound]](expr.prim.req.compound "7.5.8.4 Compound requirements"), [[expr.typeid]](expr.typeid "7.6.1.8 Type identification"), [[expr.sizeof]](expr.sizeof "7.6.2.5 Sizeof"), [[expr.unary.noexcept]](expr.unary.noexcept "7.6.2.7 noexcept operator"), [[expr.reflect]](expr.reflect "7.6.2.10 The reflection operator"), [[dcl.type.decltype]](dcl.type.decltype "9.2.9.6 Decltype specifiers"), [[temp.pre]](temp.pre "13.1 Preamble"), [[temp.concept]](temp.concept "13.7.9 Concept definitions"))[.](#1.sentence-1)
|
||
|
||
An unevaluated operand is not evaluated[.](#1.sentence-2)
|
||
|
||
[*Note [1](#note-1)*:
|
||
|
||
In an unevaluated operand, a non-static class member can be
|
||
named ([[expr.prim.id]](expr.prim.id "7.5.5 Names")) and naming of objects or functions does not, by
|
||
itself, require that a definition be provided ([[basic.def.odr]](basic.def.odr "6.3 One-definition rule"))[.](#1.sentence-3)
|
||
|
||
An unevaluated operand is considered a [full-expression](intro.execution#def:full-expression "6.10.1 Sequential execution [intro.execution]")[.](#1.sentence-4)
|
||
|
||
â *end note*]
|
||
|
||
[2](#2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/expressions.tex#L458)
|
||
|
||
In some contexts, an expression only appears for its side effects[.](#2.sentence-1)
|
||
|
||
Such an
|
||
expression is called a [*discarded-value expression*](#def:discarded-value_expression "7.2.3 Context dependence [expr.context]")[.](#2.sentence-2)
|
||
|
||
The [array-to-pointer](conv.array "7.3.3 Array-to-pointer conversion [conv.array]") and [function-to-pointer](conv.func "7.3.4 Function-to-pointer conversion [conv.func]") standard conversions are not
|
||
applied[.](#2.sentence-3)
|
||
|
||
The [lvalue-to-rvalue](conv.lval "7.3.2 Lvalue-to-rvalue conversion [conv.lval]") conversion is applied
|
||
if and only if
|
||
the expression is a glvalue of volatile-qualified type and it is one of the
|
||
following:
|
||
|
||
- [(2.1)](#2.1)
|
||
|
||
( [*expression*](expr.comma#nt:expression "7.6.20 Comma operator [expr.comma]") ), where[*expression*](expr.comma#nt:expression "7.6.20 Comma operator [expr.comma]") is one of these expressions,
|
||
|
||
- [(2.2)](#2.2)
|
||
|
||
[*id-expression*](expr.prim.id.general#nt:id-expression "7.5.5.1 General [expr.prim.id.general]") ([[expr.prim.id]](expr.prim.id "7.5.5 Names")),
|
||
|
||
- [(2.3)](#2.3)
|
||
|
||
[*splice-expression*](expr.prim.splice#nt:splice-expression "7.5.9 Expression splicing [expr.prim.splice]") ([[expr.prim.splice]](expr.prim.splice "7.5.9 Expression splicing")),
|
||
|
||
- [(2.4)](#2.4)
|
||
|
||
[subscripting](expr.sub "7.6.1.2 Subscripting [expr.sub]"),
|
||
|
||
- [(2.5)](#2.5)
|
||
|
||
[class member access](expr.ref "7.6.1.5 Class member access [expr.ref]"),
|
||
|
||
- [(2.6)](#2.6)
|
||
|
||
[indirection](expr.unary.op#def:indirection "7.6.2.2 Unary operators [expr.unary.op]"),
|
||
|
||
- [(2.7)](#2.7)
|
||
|
||
[pointer-to-member operation](expr.mptr.oper "7.6.4 Pointer-to-member operators [expr.mptr.oper]"),
|
||
|
||
- [(2.8)](#2.8)
|
||
|
||
[conditional expression](expr.cond "7.6.16 Conditional operator [expr.cond]") where both the second and the
|
||
third operands are one of these expressions, or
|
||
|
||
- [(2.9)](#2.9)
|
||
|
||
[comma expression](expr.comma "7.6.20 Comma operator [expr.comma]") where the right operand is one of
|
||
these expressions[.](#2.sentence-4)
|
||
|
||
[*Note [2](#note-2)*:
|
||
|
||
Using an overloaded operator causes a function call; the
|
||
above covers only operators with built-in meaning[.](#2.sentence-5)
|
||
|
||
â *end note*]
|
||
|
||
The temporary materialization conversion ([[conv.rval]](conv.rval "7.3.5 Temporary materialization conversion")) is applied
|
||
if the (possibly converted) expression is a prvalue of object type[.](#2.sentence-6)
|
||
|
||
[*Note [3](#note-3)*:
|
||
|
||
If the original expression is an lvalue of class type,
|
||
it must have a volatile copy constructor to initialize the temporary object
|
||
that is the result object of the temporary materialization conversion[.](#2.sentence-7)
|
||
|
||
â *end note*]
|
||
|
||
The expression is evaluated and its result (if any) is discarded[.](#2.sentence-8)
|