Skip to content

Commit b3b7d37

Browse files
jensmaurerzygoloid
authored andcommitted
[class.copy.elision] Add cross-reference, fix example.
1 parent 68aa22b commit b3b7d37

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

source/classes.tex

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6594,7 +6594,8 @@
65946594
an rvalue reference to a non-volatile object type.
65956595
In the following copy-initialization contexts, a move operation might be used instead of a copy operation:
65966596
\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
65986599
is a (possibly parenthesized) \grammarterm{id-expression}
65996600
that names an implicitly movable entity declared in the body
66006601
or \grammarterm{parameter-declaration-clause} of the innermost enclosing
@@ -6660,20 +6661,22 @@
66606661
\pnum
66616662
\begin{example}
66626663
\begin{codeblock}
6663-
void f() {
6664+
template<class T> void g(const T&);
6665+
6666+
template<class T> void f() {
66646667
T x;
66656668
try {
66666669
T y;
66676670
try { g(x); }
66686671
catch (...) {
66696672
if (/*...*/)
6670-
throw x; // does not move
6671-
throw y; // moves
6673+
throw x; // does not move
6674+
throw y; // moves
66726675
}
66736676
g(y);
66746677
} catch(...) {
66756678
g(x);
6676-
// g(y); // error
6679+
g(y); // error: \tcode{y} is not in scope
66776680
}
66786681
}
66796682
\end{codeblock}

0 commit comments

Comments
 (0)