You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you declare a template lambda:
immutable lambda(T) = (T n) => n * n;
and call it without an explicit type it errors with with:
lambda cannot deduce function from argument types !()(int)
auto x = lambda!int(2); // works
auto x = lambda(2); // not works
Is this a bug? - tired on dmd v2.077.1
The text was updated successfully, but these errors were encountered:
schveiguy (@schveiguy) commented on 2017-12-06T15:43:47Z
Tested back to 2.070.0, which is where short lambda syntax was introduced. Still fails.
The immutable looks odd, but even with alias this doesn't work.
alias lambda(T) = (T n) => n * n;
should expand to:
template lambda(T)
{
alias lambda = (T n) => n * n;
}
Neither of these successfully use IFTI.
However, these all work:
alias lambda = (int n) => n * n;
alias lambda = n => n * n;
Ali Ak reported this on 2017-12-06T10:40:16Z
Transferred from https://issues.dlang.org/show_bug.cgi?id=18037
CC List
Description
The text was updated successfully, but these errors were encountered: