On Thursday, 17 November 2016 at 01:48:51 UTC, Jonathan M Davis wrote:
Well, you _can't_ return a function. You could return a function pointer or a delegate, but not a function. What would it even mean to return a function?

Well, it works. This compiles:

auto bug(alias f)()
{
    return f;
}

void fun() {}

void main()
{
        bug!fun(); //Error: functions cannot return a function
}

So why can't I return cast(typeof(f))&f? Furthermore, it gives me the exact same error when I change it to `return *&f`.

Reply via email to