https://issues.dlang.org/show_bug.cgi?id=13845
Kenji Hara <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |INVALID --- Comment #2 from Kenji Hara <[email protected]> --- (In reply to Peter Alexander from comment #1) > alias Null = typeof(null); > auto a = (int) => 0; // ok > auto b = (typeof(null)) => 0; // ok `int` and `typeof(null)` are definitely parsed as types. > auto c = (Null x) => 0; // ok `Null x` is parsed as a parameter, typed Null and parameter name is `x`. > auto d = (Null) => 0; // error > > Error: variable bug.d type void is inferred from initializer (Null) => 0, > and variables cannot be of type void If a lambda parameter is an identifier, it's treated as the "parameter name". Therefore it is equivalent with: auto d = (x) => 0; and compiler cannot infer the lambda parameter type so there's no "target" type. --
