On Thursday, 12 June 2014 at 21:58:32 UTC, Adam D. Ruppe wrote:
since null is a value maybe you want

enum blah = null;

you may also give it a type after the enum word

I *think* the issue might be that "null" is an rvalue? Because you can alias variable names all you want. I do it all the time for templates where I *may* need a temporary.

eg:

void foo(T)(T val)
{
    static if (isUnsigned!T)
        alias uval = val;
    else
        auto uval = unsigned(val);
    ...
}

It's also quite useful with varargs:
alias a0 = args[0];

Also, you can't alias things like "int.init" either. I'm not sure the "rvalue" thing is the source, because these work:

//----struct S
{
    static int i;
    static int j() @property;
}
alias a = S.i;
alias b = S.j;
//----

I'd consider filling a bug report.

Reply via email to