|
3203 | 3203 | \end{example}
|
3204 | 3204 |
|
3205 | 3205 | \pnum
|
3206 |
| -When the criteria for elision of a copy/move operation are met, |
3207 |
| -but not for an \nonterminal{exception-declaration}, |
3208 |
| -and the object |
3209 |
| -to be copied is designated by an lvalue, |
3210 |
| -or when the \grammarterm{expression} in a \tcode{return} statement |
| 3206 | +In the following copy-initialization contexts, a move operation might be used instead of a copy operation: |
| 3207 | +\begin{itemize} |
| 3208 | +\item If the \grammarterm{expression} in a \tcode{return} statement~(\ref{stmt.return}) |
3211 | 3209 | is a (possibly parenthesized) \grammarterm{id-expression}
|
3212 | 3210 | that names an object with automatic storage duration declared in the body
|
3213 | 3211 | or \grammarterm{parameter-declaration-clause} of the innermost enclosing
|
3214 |
| -function or \grammarterm{lambda-expression}, |
| 3212 | +function or \grammarterm{lambda-expression}, or |
| 3213 | + |
| 3214 | +\item if the operand of a \grammarterm{throw-expression}~(\ref{expr.throw}) |
| 3215 | +is the name of a non-volatile automatic object |
| 3216 | +(other than a function or catch-clause parameter) |
| 3217 | +whose scope does not extend beyond the end of the innermost enclosing |
| 3218 | +\grammarterm{try-block} (if there is one), |
| 3219 | +\end{itemize} |
3215 | 3220 | overload resolution to select the constructor
|
3216 |
| -for the copy is first performed as if the object were designated by an rvalue. |
| 3221 | +for the copy is first performed as if the object were designated by an |
| 3222 | +rvalue. |
3217 | 3223 | If the first overload resolution fails or was not performed,
|
3218 | 3224 | or if the type of the first parameter of the selected
|
3219 | 3225 | constructor is not an rvalue reference to the object's type (possibly cv-qualified),
|
|
3224 | 3230 | elision is not performed, and the selected constructor must be accessible even if
|
3225 | 3231 | the call is elided.
|
3226 | 3232 | \end{note}
|
| 3233 | + |
| 3234 | +\pnum |
3227 | 3235 | \begin{example}
|
3228 | 3236 | \begin{codeblock}
|
3229 | 3237 | class Thing {
|
|
0 commit comments