https://issues.dlang.org/show_bug.cgi?id=19241
Issue ID: 19241 Summary: Broken value of auto ref argument for closure Product: D Version: D2 Hardware: x86 OS: Windows Status: NEW Severity: enhancement Priority: P1 Component: dmd Assignee: nob...@puremagic.com Reporter: zan77...@nifty.com This code doesn't work: ------------------- auto ref run(F, Args...)(F dg, auto ref Args args) { return dg(args); } auto makeClosure(alias func, Args...)(auto ref Args args) { auto fptr = args[0].funcptr; return { // !!!!! Assertion failure !!!!! assert(args[0].funcptr is fptr); return func(args); }; } auto test(F, Args...)(F dg, auto ref Args args) { return makeClosure!run(dg, args); } void main() { auto t = test( delegate ()=> 10 ); assert(t() == 10); } ------------------- dmd -debug -g -run main.d ------------------- core.exception.AssertError@main.d(9): Assertion failure ---------------- 0x004029B3 in _d_assertp at ...\src\core\exception.d(436) 0x0040225B in _Dmain at main.d(20) --