On Sunday, 8 March 2015 at 21:11:12 UTC, Meta wrote:
Yeah, definitely wrong.

template canBeAlias(T...)
if (T.length == 1)
{
        static if (is(typeof({alias _ = T[0];})))
        {
                enum canBeAlias = true;
        }
        else
        {
                enum canBeAlias = false;
        }
}

void main()
{
    pragma(msg, canBeAlias!canBeAlias); //prints "true"
static assert(canBeAlias!(canBeAlias!canBeAlias)); //passes?! static assert(!canBeAlias!true); //Error: static assert(!true) is false
}

OR

void main()
{
    pragma(msg, canBeAlias!canBeAlias); //prints "true"
    static assert(!canBeAlias!true); //passes
    //Error: static assert (canBeAlias!(true)) is false
    static assert(canBeAlias!(canBeAlias!canBeAlias));
}

So it definitely does depend on which comes first. This is a weird bug...

Urgh, I'm all messed up now. The results in the second case are correct, but the results in the first case are wrong, as !canBeAlias!true should be !false, not !true.

Reply via email to