[Issue 14657] can alias auto ref function but only after it's been called before

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Jun 8 23:18:19 PDT 2015


https://issues.dlang.org/show_bug.cgi?id=14657

Daniel Kozak <kozzi11 at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kozzi11 at gmail.com

--- Comment #1 from Daniel Kozak <kozzi11 at gmail.com> ---
IMHO this should not work:
alias u = unaryFun!();

it does not make sense. In curent dmd it alias to first template instantiation.
So even this does not work:

void unaryFun()(auto ref int a) pure nothrow @safe @nogc {}
void main()
{
    int x;
    unaryFun!()(x);
    unaryFun!()(41);
    alias u = unaryFun!();
    u(41);
}

m.d(8): Error: function m.unaryFun!().unaryFun (auto ref int a) is not callable
using argument types (int)

So I would say
alias u = unaryFun!(); should be forbidden and some better error message can be
print.

Something like this:
Error: alias u = unaryFun!() cannot be use do you mean alias u = unaryFun?

--


More information about the Digitalmars-d-bugs mailing list