Skip to content

Commit

Permalink
Merge 2018-06 CWG Motion 3
Browse files Browse the repository at this point in the history
Fixes #2115
  • Loading branch information
zygoloid committed Jun 18, 2018
2 parents a22928a + 4ce0542 commit cdbd6c9
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
2 changes: 2 additions & 0 deletions source/expressions.tex
Original file line number Diff line number Diff line change
Expand Up @@ -1392,6 +1392,8 @@
the entity is said to be \defnx{implicitly captured}{capture!implicit}
by each intervening \grammarterm{lambda-expression} with an associated
\grammarterm{capture-default} that does not explicitly capture it.
The implicit capture of \tcode{*this} is deprecated when the
\grammarterm{capture-default} is \tcode{=}; see \ref{depr.capture.this}.
\begin{example}
\begin{codeblock}
void f(int, const int (&)[2] = {}); // \#1
Expand Down
19 changes: 19 additions & 0 deletions source/future.tex
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,25 @@
An implementation may declare library names and entities described in this Clause with the
\tcode{deprecated} attribute\iref{dcl.attr.deprecated}.

\rSec1[depr.capture.this]{Implicit capture of \tcode{*this} by reference}

\pnum
For compatibility with prior \Cpp{} International Standards,
a lambda expression with \grammarterm{capture-default}
\tcode{=}\iref{expr.prim.lambda.capture} may implicitly capture
\tcode{*this} by reference.
\begin{example}
\begin{codeblock}
struct X {
int x;
void foo(int n) {
auto f = [=]() { x = n; }; // deprecated: \tcode{x} means \tcode{this->x}, not a copy thereof
auto g = [=, this]() { x = n; }; // recommended replacement
}
};
\end{codeblock}
\end{example}

\rSec1[depr.static_constexpr]{Redeclaration of \tcode{static constexpr} data members}

\pnum
Expand Down

0 comments on commit cdbd6c9

Please sign in to comment.