https://issues.dlang.org/show_bug.cgi?id=11012
ZombineDev <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |[email protected] --- Comment #5 from ZombineDev <[email protected]> --- (In reply to Alexander from comment #3) > static assert(is(typeof( (){} ) == function)); // fails as well > > This issue doesn't allow to get lambda parameter types tuple, and this > blocks my development. I'll try to have a look at the dmd source. Is the blocking issue that in code similar to the following, there's an error on line 11: --- import std.traits; pragma (msg, ReturnType!( (){} )); // void pragma (msg, Parameters!( (){} )); // () pragma (msg, ReturnType!( (int x, double y) => "test" )); // string pragma (msg, Parameters!( (int x, double y) => "test" )); // (int, double) void lambdaTypeWithParameter(alias lambda, Param)(Param p) { pragma (msg, Parameters!(lambda)); // line 11 - doesn't compile alias RT = typeof(lambda(p)); pragma (msg, RT); // line 15 } void main() { lambdaTypeWithParameter!(x => "test2")(true); // line 15 -> string lambdaTypeWithParameter!(x => x)(2); // line 15 -> int lambdaTypeWithParameter!(x => 3.0 * x)(2); // line 15 -> double } --- ? If that's the case, the error is expected since the lambda in that context is polymorphic - an un-instantiated function template meaning that its parameters are not bound to a specific type. --
