Skip to content

Commit a4db413

Browse files
committed
CWG2561 Conversion to function pointer for lambda with explicit object parameter
1 parent 523377a commit a4db413

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
@@ -1901,8 +1901,9 @@
19011901
if the lambda has a \grammarterm{template-parameter-list}.
19021902
\begin{example}
19031903
\begin{codeblock}
1904-
int i = [](int i, auto a) { return i; }(3, 4); // OK, a generic lambda
1905-
int j = []<class T>(T t, int i) { return i; }(3, 4); // OK, a generic lambda
1904+
auto x = [](int i, auto a) { return i; }; // OK, a generic lambda
1905+
auto y = [](this auto self, int i) { return i; }; // OK, a generic lambda
1906+
auto z = []<class T>(int i) { return i; }; // OK, a generic lambda
19061907
\end{codeblock}
19071908
\end{example}
19081909

@@ -2114,6 +2115,7 @@
21142115
\pnum
21152116
The closure type for a non-generic \grammarterm{lambda-expression} with no
21162117
\grammarterm{lambda-capture}
2118+
and no explicit object parameter\iref{dcl.fct}
21172119
whose constraints (if any) are satisfied
21182120
has a conversion function to pointer to
21192121
function with \Cpp{} language linkage\iref{dcl.link} having
@@ -2134,7 +2136,9 @@
21342136
if the function call operator is an immediate function.
21352137

21362138
\pnum
2137-
For a generic lambda with no \grammarterm{lambda-capture}, the closure type has a
2139+
For a generic lambda with no \grammarterm{lambda-capture}
2140+
and no explicit object parameter\iref{dcl.fct},
2141+
the closure type has a
21382142
conversion function template to
21392143
pointer to function. The conversion function template has the same invented
21402144
template parameter list, and the pointer to function has the same

0 commit comments

Comments
 (0)