From Jason Turner

[expr.prop]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpsqbl49us/{from.md → to.md} +38 -38
tmp/tmpsqbl49us/{from.md → to.md} RENAMED
@@ -8,18 +8,16 @@ Expressions are categorized according to the taxonomy in Figure
8
  <a id="fig:basic.lval"></a>
9
 
10
  ![Expression category taxonomy \[fig:basic.lval\]](images/valuecategories.svg)
11
 
12
  - A *glvalue* is an expression whose evaluation determines the identity
13
- of an object, bit-field, or function.
14
  - A *prvalue* is an expression whose evaluation initializes an object or
15
- a bit-field, or computes the value of an operand of an operator, as
16
- specified by the context in which it appears, or an expression that
17
- has type cv `void`.
18
- - An *xvalue* is a glvalue that denotes an object or bit-field whose
19
- resources can be reused (usually because it is near the end of its
20
- lifetime).
21
  - An *lvalue* is a glvalue that is not an xvalue.
22
  - An *rvalue* is a prvalue or an xvalue.
23
 
24
  Every expression belongs to exactly one of the fundamental
25
  classifications in this taxonomy: lvalue, xvalue, or prvalue. This
@@ -43,15 +41,15 @@ values. — *end note*]
43
 
44
  [*Note 3*:
45
 
46
  An expression is an xvalue if it is:
47
 
 
48
  - the result of calling a function, whether implicitly or explicitly,
49
  whose return type is an rvalue reference to object type [[expr.call]],
50
- - a cast to an rvalue reference to object type ([[expr.type.conv]],
51
- [[expr.dynamic.cast]], [[expr.static.cast]] [[expr.reinterpret.cast]],
52
- [[expr.const.cast]], [[expr.cast]]),
53
  - a subscripting operation with an xvalue array operand [[expr.sub]],
54
  - a class member access expression designating a non-static data member
55
  of non-reference type in which the object expression is an xvalue
56
  [[expr.ref]], or
57
  - a `.*` pointer-to-member expression in which the first operand is an
@@ -121,26 +119,26 @@ glvalue for that operand, the temporary materialization conversion
121
 
122
  The discussion of reference initialization in  [[dcl.init.ref]] and of
123
  temporaries in  [[class.temporary]] indicates the behavior of lvalues
124
  and rvalues in other significant contexts.
125
 
126
- Unless otherwise indicated [[dcl.type.simple]], a prvalue shall always
127
  have complete type or the `void` type; if it has a class type or
128
- (possibly multi-dimensional) array of class type, that class shall not
129
- be an abstract class [[class.abstract]]. A glvalue shall not have type
130
  cv `void`.
131
 
132
- [*Note 8*: A glvalue may have complete or incomplete non-`void` type.
133
  Class and array prvalues can have cv-qualified types; other prvalues
134
  always have cv-unqualified types. See [[expr.type]]. — *end note*]
135
 
136
  An lvalue is *modifiable* unless its type is const-qualified or is a
137
  function type.
138
 
139
  [*Note 9*: A program that attempts to modify an object through a
140
- nonmodifiable lvalue or through an rvalue is ill-formed ([[expr.ass]],
141
- [[expr.post.incr]], [[expr.pre.incr]]). — *end note*]
142
 
143
  If a program attempts to access [[defns.access]] the stored value of an
144
  object through a glvalue whose type is not similar [[conv.qual]] to one
145
  of the following types the behavior is undefined:[^4]
146
 
@@ -152,17 +150,18 @@ of the following types the behavior is undefined:[^4]
152
  If a program invokes a defaulted copy/move constructor or copy/move
153
  assignment operator for a union of type `U` with a glvalue argument that
154
  does not denote an object of type cv `U` within its lifetime, the
155
  behavior is undefined.
156
 
157
- [*Note 10*: Unlike in C, C++ has no accesses of class
158
- type. *end note*]
 
159
 
160
  ### Type <a id="expr.type">[[expr.type]]</a>
161
 
162
- If an expression initially has the type “reference to `T`” (
163
- [[dcl.ref]], [[dcl.init.ref]]), the type is adjusted to `T` prior to any
164
  further analysis. The expression designates the object or function
165
  denoted by the reference, and the expression is an lvalue or an xvalue,
166
  depending on the expression.
167
 
168
  [*Note 1*: Before the lifetime of the reference has started or after it
@@ -187,26 +186,27 @@ pointer-to-member type or `std::nullptr_t`, is:
187
  - if `T1` or `T2` is “pointer to `noexcept` function” and the other type
188
  is “pointer to function”, where the function types are otherwise the
189
  same, “pointer to function”;
190
  - if `T1` is “pointer to *cv1* `C1`” and `T2` is “pointer to *cv2*
191
  `C2`”, where `C1` is reference-related to `C2` or `C2` is
192
- reference-related to `C1` [[dcl.init.ref]], the cv-combined type
193
- [[conv.qual]] of `T1` and `T2` or the cv-combined type of `T2` and
194
- `T1`, respectively;
195
  - if `T1` or `T2` is “pointer to member of `C1` of type function”, the
196
  other type is “pointer to member of `C2` of type `noexcept` function”,
197
  and `C1` is reference-related to `C2` or `C2` is reference-related to
198
  `C1` [[dcl.init.ref]], where the function types are otherwise the
199
  same, “pointer to member of `C2` of type function” or “pointer to
200
  member of `C1` of type function”, respectively;
201
  - if `T1` is “pointer to member of `C1` of type *cv1* `U`” and `T2` is
202
  “pointer to member of `C2` of type *cv2* `U`”, for some non-function
203
  type `U`, where `C1` is reference-related to `C2` or `C2` is
204
- reference-related to `C1` [[dcl.init.ref]], the cv-combined type of
205
- `T2` and `T1` or the cv-combined type of `T1` and `T2`, respectively;
206
- - if `T1` and `T2` are similar types [[conv.qual]], the cv-combined type
207
- of `T1` and `T2`;
 
208
  - otherwise, a program that necessitates the determination of a
209
  composite pointer type is ill-formed.
210
 
211
  [*Example 1*:
212
 
@@ -223,16 +223,15 @@ pointer to `const int`”.
223
 
224
  — *end example*]
225
 
226
  ### Context dependence <a id="expr.context">[[expr.context]]</a>
227
 
228
- In some contexts, *unevaluated operands* appear ([[expr.prim.req]],
229
- [[expr.typeid]], [[expr.sizeof]], [[expr.unary.noexcept]],
230
- [[dcl.type.simple]], [[temp.pre]], [[temp.concept]]). An unevaluated
231
- operand is not evaluated.
232
 
233
- [*Note 1*: In an unevaluated operand, a non-static class member may be
234
  named [[expr.prim.id]] and naming of objects or functions does not, by
235
  itself, require that a definition be provided [[basic.def.odr]]. An
236
  unevaluated operand is considered a full-expression
237
  [[intro.execution]]. — *end note*]
238
 
@@ -255,14 +254,15 @@ volatile-qualified type and it is one of the following:
255
  these expressions.
256
 
257
  [*Note 2*: Using an overloaded operator causes a function call; the
258
  above covers only operators with built-in meaning. — *end note*]
259
 
260
- If the (possibly converted) expression is a prvalue, the temporary
261
- materialization conversion [[conv.rval]] is applied.
262
 
263
- [*Note 3*: If the expression is an lvalue of class type, it must have a
264
- volatile copy constructor to initialize the temporary object that is the
265
- result object of the lvalue-to-rvalue conversion. — *end note*]
 
266
 
267
- The glvalue expression is evaluated and its value is discarded.
268
 
 
8
  <a id="fig:basic.lval"></a>
9
 
10
  ![Expression category taxonomy \[fig:basic.lval\]](images/valuecategories.svg)
11
 
12
  - A *glvalue* is an expression whose evaluation determines the identity
13
+ of an object or function.
14
  - A *prvalue* is an expression whose evaluation initializes an object or
15
+ computes the value of an operand of an operator, as specified by the
16
+ context in which it appears, or an expression that has type cv `void`.
17
+ - An *xvalue* is a glvalue that denotes an object whose resources can be
18
+ reused (usually because it is near the end of its lifetime).
 
 
19
  - An *lvalue* is a glvalue that is not an xvalue.
20
  - An *rvalue* is a prvalue or an xvalue.
21
 
22
  Every expression belongs to exactly one of the fundamental
23
  classifications in this taxonomy: lvalue, xvalue, or prvalue. This
 
41
 
42
  [*Note 3*:
43
 
44
  An expression is an xvalue if it is:
45
 
46
+ - a move-eligible *id-expression* [[expr.prim.id.unqual]],
47
  - the result of calling a function, whether implicitly or explicitly,
48
  whose return type is an rvalue reference to object type [[expr.call]],
49
+ - a cast to an rvalue reference to object type
50
+ [[expr.type.conv]], [[expr.dynamic.cast]], [[expr.static.cast]], [[expr.reinterpret.cast]], [[expr.const.cast]], [[expr.cast]],
 
51
  - a subscripting operation with an xvalue array operand [[expr.sub]],
52
  - a class member access expression designating a non-static data member
53
  of non-reference type in which the object expression is an xvalue
54
  [[expr.ref]], or
55
  - a `.*` pointer-to-member expression in which the first operand is an
 
119
 
120
  The discussion of reference initialization in  [[dcl.init.ref]] and of
121
  temporaries in  [[class.temporary]] indicates the behavior of lvalues
122
  and rvalues in other significant contexts.
123
 
124
+ Unless otherwise indicated [[dcl.type.decltype]], a prvalue shall always
125
  have complete type or the `void` type; if it has a class type or
126
+ (possibly multidimensional) array of class type, that class shall not be
127
+ an abstract class [[class.abstract]]. A glvalue shall not have type
128
  cv `void`.
129
 
130
+ [*Note 8*: A glvalue can have complete or incomplete non-`void` type.
131
  Class and array prvalues can have cv-qualified types; other prvalues
132
  always have cv-unqualified types. See [[expr.type]]. — *end note*]
133
 
134
  An lvalue is *modifiable* unless its type is const-qualified or is a
135
  function type.
136
 
137
  [*Note 9*: A program that attempts to modify an object through a
138
+ nonmodifiable lvalue or through an rvalue is ill-formed
139
+ [[expr.ass]], [[expr.post.incr]], [[expr.pre.incr]]. — *end note*]
140
 
141
  If a program attempts to access [[defns.access]] the stored value of an
142
  object through a glvalue whose type is not similar [[conv.qual]] to one
143
  of the following types the behavior is undefined:[^4]
144
 
 
150
  If a program invokes a defaulted copy/move constructor or copy/move
151
  assignment operator for a union of type `U` with a glvalue argument that
152
  does not denote an object of type cv `U` within its lifetime, the
153
  behavior is undefined.
154
 
155
+ [*Note 10*: In C, an entire object of structure type can be accessed,
156
+ e.g., using assignment. By contrast, C++ has no notion of accessing an
157
+ object of class type through an lvalue of class type. — *end note*]
158
 
159
  ### Type <a id="expr.type">[[expr.type]]</a>
160
 
161
+ If an expression initially has the type “reference to `T`”
162
+ [[dcl.ref]], [[dcl.init.ref]], the type is adjusted to `T` prior to any
163
  further analysis. The expression designates the object or function
164
  denoted by the reference, and the expression is an lvalue or an xvalue,
165
  depending on the expression.
166
 
167
  [*Note 1*: Before the lifetime of the reference has started or after it
 
186
  - if `T1` or `T2` is “pointer to `noexcept` function” and the other type
187
  is “pointer to function”, where the function types are otherwise the
188
  same, “pointer to function”;
189
  - if `T1` is “pointer to *cv1* `C1`” and `T2` is “pointer to *cv2*
190
  `C2`”, where `C1` is reference-related to `C2` or `C2` is
191
+ reference-related to `C1` [[dcl.init.ref]], the qualification-combined
192
+ type [[conv.qual]] of `T1` and `T2` or the qualification-combined type
193
+ of `T2` and `T1`, respectively;
194
  - if `T1` or `T2` is “pointer to member of `C1` of type function”, the
195
  other type is “pointer to member of `C2` of type `noexcept` function”,
196
  and `C1` is reference-related to `C2` or `C2` is reference-related to
197
  `C1` [[dcl.init.ref]], where the function types are otherwise the
198
  same, “pointer to member of `C2` of type function” or “pointer to
199
  member of `C1` of type function”, respectively;
200
  - if `T1` is “pointer to member of `C1` of type *cv1* `U`” and `T2` is
201
  “pointer to member of `C2` of type *cv2* `U`”, for some non-function
202
  type `U`, where `C1` is reference-related to `C2` or `C2` is
203
+ reference-related to `C1` [[dcl.init.ref]], the qualification-combined
204
+ type of `T2` and `T1` or the qualification-combined type of `T1` and
205
+ `T2`, respectively;
206
+ - if `T1` and `T2` are similar types [[conv.qual]], the
207
+ qualification-combined type of `T1` and `T2`;
208
  - otherwise, a program that necessitates the determination of a
209
  composite pointer type is ill-formed.
210
 
211
  [*Example 1*:
212
 
 
223
 
224
  — *end example*]
225
 
226
  ### Context dependence <a id="expr.context">[[expr.context]]</a>
227
 
228
+ In some contexts, *unevaluated operands* appear
229
+ [[expr.prim.req]], [[expr.typeid]], [[expr.sizeof]], [[expr.unary.noexcept]], [[dcl.type.decltype]], [[temp.pre]], [[temp.concept]].
230
+ An unevaluated operand is not evaluated.
 
231
 
232
+ [*Note 1*: In an unevaluated operand, a non-static class member can be
233
  named [[expr.prim.id]] and naming of objects or functions does not, by
234
  itself, require that a definition be provided [[basic.def.odr]]. An
235
  unevaluated operand is considered a full-expression
236
  [[intro.execution]]. — *end note*]
237
 
 
254
  these expressions.
255
 
256
  [*Note 2*: Using an overloaded operator causes a function call; the
257
  above covers only operators with built-in meaning. — *end note*]
258
 
259
+ The temporary materialization conversion [[conv.rval]] is applied if the
260
+ (possibly converted) expression is a prvalue of object type.
261
 
262
+ [*Note 3*: If the original expression is an lvalue of class type, it
263
+ must have a volatile copy constructor to initialize the temporary object
264
+ that is the result object of the temporary materialization
265
+ conversion. — *end note*]
266
 
267
+ The expression is evaluated and its result (if any) is discarded.
268