We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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)
The text was updated successfully, but these errors were encountered:
Yeah, `auto ref` is really not a good think when mixed with capture. And unfortunately it's `@safe`.
Sorry, something went wrong.
No branches or pull requests
SHOO (@shoo) reported this on 2018-09-11T09:22:12Z
Transferred from https://issues.dlang.org/show_bug.cgi?id=19241
CC List
Description
The text was updated successfully, but these errors were encountered: