File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change 6594
6594
an rvalue reference to a non-volatile object type.
6595
6595
In the following copy-initialization contexts, a move operation might be used instead of a copy operation:
6596
6596
\begin {itemize }
6597
- \item If the \grammarterm {expression} in a \tcode {return} or \tcode {co_return} statement\iref {stmt.return }
6597
+ \item If the \grammarterm {expression} in a \tcode {return}\iref {stmt.return } or
6598
+ \tcode {co_return}\iref {stmt.return.coroutine } statement
6598
6599
is a (possibly parenthesized) \grammarterm {id-expression}
6599
6600
that names an implicitly movable entity declared in the body
6600
6601
or \grammarterm {parameter-declaration-clause} of the innermost enclosing
6660
6661
\pnum
6661
6662
\begin {example }
6662
6663
\begin {codeblock }
6663
- void f() {
6664
+ template<class T> void g(const T&);
6665
+
6666
+ template<class T> void f() {
6664
6667
T x;
6665
6668
try {
6666
6669
T y;
6667
6670
try { g(x); }
6668
6671
catch (...) {
6669
6672
if (/*...*/)
6670
- throw x; // does not move
6671
- throw y; // moves
6673
+ throw x; // does not move
6674
+ throw y; // moves
6672
6675
}
6673
6676
g(y);
6674
6677
} catch(...) {
6675
6678
g(x);
6676
- // g(y); // error
6679
+ g(y); // error: \tcode {y} is not in scope
6677
6680
}
6678
6681
}
6679
6682
\end {codeblock }
You can’t perform that action at this time.
0 commit comments