|
270 | 270 |
|
271 | 271 | \pnum
|
272 | 272 | An expression is \defn{potentially evaluated} unless it is an
|
273 |
| -unevaluated operand\iref{expr} or a subexpression thereof. |
| 273 | +unevaluated operand\iref{expr.prop} or a subexpression thereof. |
274 | 274 | The set of \defn{potential results} of an expression \tcode{e} is
|
275 | 275 | defined as follows:
|
276 | 276 | \begin{itemize}
|
|
320 | 320 | and, if \tcode{x} is an object, \tcode{ex} is an element of
|
321 | 321 | the set of potential results of an expression \tcode{e}, where either the lvalue-to-rvalue
|
322 | 322 | conversion\iref{conv.lval} is applied to \tcode{e}, or \tcode{e} is
|
323 |
| -a discarded-value expression\iref{expr}. |
| 323 | +a discarded-value expression\iref{expr.prop}. |
324 | 324 | \tcode{this} is odr-used if it appears as a potentially-evaluated expression
|
325 | 325 | (including as the result of the implicit transformation in the body of a non-static
|
326 | 326 | member function~(\ref{class.mfct.non-static})).
|
|
2529 | 2529 | generates information associated with each such object that makes it
|
2530 | 2530 | possible to determine that object's type during program execution. For
|
2531 | 2531 | other objects, the interpretation of the values found therein is
|
2532 |
| -determined by the type of the \grammarterm{expression}{s}\iref{expr} |
| 2532 | +determined by the type of the \grammarterm{expression}{s}\iref{expr.compound} |
2533 | 2533 | used to access them.
|
2534 | 2534 |
|
2535 | 2535 | \pnum
|
|
4155 | 4155 | \end{example}%
|
4156 | 4156 | \indextext{type|)}
|
4157 | 4157 |
|
4158 |
| -\rSec1[basic.lval]{Lvalues and rvalues} |
4159 |
| -\pnum |
4160 |
| -Expressions are categorized according to the taxonomy in Figure~\ref{fig:categories}. |
4161 |
| - |
4162 |
| -\begin{importgraphic} |
4163 |
| -{Expression category taxonomy} |
4164 |
| -{fig:categories} |
4165 |
| -{valuecategories.pdf} |
4166 |
| -\end{importgraphic} |
4167 |
| - |
4168 |
| -\begin{itemize} |
4169 |
| -\item A \defn{glvalue} is an expression whose evaluation determines the identity of an object, bit-field, or function. |
4170 |
| -\item A \defn{prvalue} is an expression whose evaluation initializes an object or a bit-field, |
4171 |
| -or computes the value of the operand of an operator, |
4172 |
| -as specified by the context in which it appears. |
4173 |
| -\item An \defn{xvalue} is a glvalue that denotes an object or bit-field whose resources can be reused (usually because it is near the end of its lifetime). |
4174 |
| -\begin{example} |
4175 |
| -Certain kinds of expressions involving rvalue references\iref{dcl.ref} yield xvalues, |
4176 |
| -such as a call to a function whose return type is an rvalue reference |
4177 |
| -or a cast to an rvalue reference type. |
4178 |
| -\end{example} |
4179 |
| -\item An \defn{lvalue} is a glvalue that is not an xvalue. |
4180 |
| -\item An \defn{rvalue} is a prvalue or an xvalue. |
4181 |
| -\end{itemize} |
4182 |
| -\begin{note} |
4183 |
| -Historically, lvalues and rvalues were so-called |
4184 |
| -because they could appear on the left- and right-hand side of an assignment |
4185 |
| -(although this is no longer generally true); |
4186 |
| -glvalues are ``generalized'' lvalues, |
4187 |
| -prvalues are ``pure'' rvalues, |
4188 |
| -and xvalues are ``eXpiring'' lvalues. |
4189 |
| -Despite their names, these terms classify expressions, not values. |
4190 |
| -\end{note} |
4191 |
| -Every expression belongs to exactly one of the fundamental classifications in this |
4192 |
| -taxonomy: lvalue, xvalue, or prvalue. This property of an expression is called |
4193 |
| -its \defn{value category}. \begin{note} The discussion of each built-in operator in |
4194 |
| -\ref{expr} indicates the category of the value it yields and the value categories |
4195 |
| -of the operands it expects. For example, the built-in assignment operators expect that |
4196 |
| -the left operand is an lvalue and that the right operand is a prvalue and yield an |
4197 |
| -lvalue as the result. User-defined operators are functions, and the categories of |
4198 |
| -values they expect and yield are determined by their parameter and return types. \end{note} |
4199 |
| - |
4200 |
| -\pnum |
4201 |
| -The \defnx{result}{result!prvalue} of a prvalue |
4202 |
| -is the value that the expression stores into its context. |
4203 |
| -A prvalue whose result is the value \placeholder{V} |
4204 |
| -is sometimes said to have or name the value \placeholder{V}. |
4205 |
| -The \defn{result object} of a prvalue |
4206 |
| -is the object initialized by the prvalue; |
4207 |
| -a prvalue |
4208 |
| -that is used to compute the value of an operand of an operator or |
4209 |
| -that has type \cv{}~\tcode{void} |
4210 |
| -has no result object. |
4211 |
| -\begin{note} |
4212 |
| -Except when the prvalue is the operand of a \grammarterm{decltype-specifier}, |
4213 |
| -a prvalue of class or array type always has a result object. |
4214 |
| -For a discarded prvalue, a temporary object is materialized; see \ref{expr}. |
4215 |
| -\end{note} |
4216 |
| -The \defnx{result}{result!glvalue} of a glvalue is the entity denoted by the expression. |
4217 |
| - |
4218 |
| -\pnum |
4219 |
| -\begin{note} |
4220 |
| -Whenever a glvalue appears in a context where a prvalue is expected, the glvalue is converted |
4221 |
| -to a prvalue; see~\ref{conv.lval}, \ref{conv.array}, |
4222 |
| -and~\ref{conv.func}. |
4223 |
| -An attempt to bind an rvalue reference to an lvalue is not such a context; see~\ref{dcl.init.ref}. |
4224 |
| -\end{note} |
4225 |
| -\begin{note} |
4226 |
| -There are no prvalue bit-fields; if a bit-field is converted to a |
4227 |
| -prvalue\iref{conv.lval}, a prvalue of the type of the bit-field is |
4228 |
| -created, which might then be promoted\iref{conv.prom}. |
4229 |
| -\end{note} |
4230 |
| - |
4231 |
| -\pnum |
4232 |
| -\begin{note} |
4233 |
| -Whenever a prvalue appears in a context where a glvalue is expected, |
4234 |
| -the prvalue is converted to an xvalue; see~\ref{conv.rval}. |
4235 |
| -\end{note} |
4236 |
| - |
4237 |
| -\pnum |
4238 |
| -The discussion of reference initialization in~\ref{dcl.init.ref} and of |
4239 |
| -temporaries in~\ref{class.temporary} indicates the behavior of lvalues |
4240 |
| -and rvalues in other significant contexts. |
4241 |
| - |
4242 |
| -\pnum |
4243 |
| -Unless otherwise indicated\iref{expr.call}, |
4244 |
| -a prvalue shall always have complete type or the \tcode{void} type. |
4245 |
| -A glvalue shall not have type \cv{}~\tcode{void}. |
4246 |
| -\begin{note} |
4247 |
| -A glvalue may have complete or incomplete non-\tcode{void} type. |
4248 |
| -Class and array prvalues can have cv-qualified types; other prvalues |
4249 |
| -always have cv-unqualified types. See \ref{expr}. |
4250 |
| -\end{note} |
4251 |
| - |
4252 |
| -\pnum |
4253 |
| -An lvalue is \defn{modifiable} unless its type is const-qualified |
4254 |
| -or is a function type. |
4255 |
| -\begin{note} |
4256 |
| -A program that attempts |
4257 |
| -to modify an object through a nonmodifiable lvalue expression or through an rvalue expression |
4258 |
| -is ill-formed~(\ref{expr.ass}, \ref{expr.post.incr}, \ref{expr.pre.incr}). |
4259 |
| -\end{note} |
4260 |
| - |
4261 |
| -\pnum |
4262 |
| -If a program attempts to access the stored value of an object through a glvalue |
4263 |
| -of other than one of the following types the behavior is |
4264 |
| -undefined:\footnote{The intent of this list is to specify those circumstances in which an |
4265 |
| -object may or may not be aliased.} |
4266 |
| -\begin{itemize} |
4267 |
| -\item the dynamic type of the object, |
4268 |
| - |
4269 |
| -\item a cv-qualified version of the dynamic type of the object, |
4270 |
| - |
4271 |
| -\item a type similar (as defined in~\ref{conv.qual}) to the dynamic type |
4272 |
| -of the object, |
4273 |
| - |
4274 |
| -\item a type that is the signed or unsigned type corresponding to the |
4275 |
| -dynamic type of the object, |
4276 |
| - |
4277 |
| -\item a type that is the signed or unsigned type corresponding to a |
4278 |
| -cv-qualified version of the dynamic type of the object, |
4279 |
| - |
4280 |
| -\item an aggregate or union type that includes one of the aforementioned types among its |
4281 |
| -elements or non-static data members (including, recursively, an element or non-static data member of a |
4282 |
| -subaggregate or contained union), |
4283 |
| - |
4284 |
| -\item a type that is a (possibly cv-qualified) base class type of the dynamic type of |
4285 |
| -the object, |
4286 |
| - |
4287 |
| -\item a \tcode{char}, \tcode{unsigned char}, or \tcode{std::byte} type. |
4288 |
| -\end{itemize} |
4289 |
| - |
4290 | 4158 | \rSec1[basic.exec]{Program execution}
|
4291 | 4159 |
|
4292 | 4160 | \rSec2[intro.execution]{Sequential execution}
|
|
4326 | 4194 | The \defnx{immediate subexpressions}{immediate subexpression} of an expression \tcode{e} are
|
4327 | 4195 | \begin{itemize}
|
4328 | 4196 | \item
|
4329 |
| -the constituent expressions of \tcode{e}'s operands\iref{expr}, |
| 4197 | +the constituent expressions of \tcode{e}'s operands\iref{expr.prop}, |
4330 | 4198 | \item
|
4331 | 4199 | any function call that \tcode{e} implicitly invokes,
|
4332 | 4200 | \item
|
|
4356 | 4224 | A \defn{full-expression} is
|
4357 | 4225 | \begin{itemize}
|
4358 | 4226 | \item
|
4359 |
| -an unevaluated operand\iref{expr}, |
| 4227 | +an unevaluated operand\iref{expr.prop}, |
4360 | 4228 | \item
|
4361 | 4229 | a \grammarterm{constant-expression}\iref{expr.const},
|
4362 | 4230 | \item
|
|
0 commit comments