Skip to content

Commit 4596a87

Browse files
burblebeetkoeppe
authored andcommitted
CWG2561 Conversion to function pointer for lambda with explicit object parameter
1 parent 2e188e5 commit 4596a87

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

source/expressions.tex

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1903,8 +1903,9 @@
19031903
if the lambda has a \grammarterm{template-parameter-list}.
19041904
\begin{example}
19051905
\begin{codeblock}
1906-
int i = [](int i, auto a) { return i; }(3, 4); // OK, a generic lambda
1907-
int j = []<class T>(T t, int i) { return i; }(3, 4); // OK, a generic lambda
1906+
auto x = [](int i, auto a) { return i; }; // OK, a generic lambda
1907+
auto y = [](this auto self, int i) { return i; }; // OK, a generic lambda
1908+
auto z = []<class T>(int i) { return i; }; // OK, a generic lambda
19081909
\end{codeblock}
19091910
\end{example}
19101911

@@ -2116,6 +2117,7 @@
21162117
\pnum
21172118
The closure type for a non-generic \grammarterm{lambda-expression} with no
21182119
\grammarterm{lambda-capture}
2120+
and no explicit object parameter\iref{dcl.fct}
21192121
whose constraints (if any) are satisfied
21202122
has a conversion function to pointer to
21212123
function with \Cpp{} language linkage\iref{dcl.link} having
@@ -2136,7 +2138,9 @@
21362138
if the function call operator is an immediate function.
21372139

21382140
\pnum
2139-
For a generic lambda with no \grammarterm{lambda-capture}, the closure type has a
2141+
For a generic lambda with no \grammarterm{lambda-capture}
2142+
and no explicit object parameter\iref{dcl.fct},
2143+
the closure type has a
21402144
conversion function template to
21412145
pointer to function. The conversion function template has the same invented
21422146
template parameter list, and the pointer to function has the same

0 commit comments

Comments
 (0)