[Issue 10708] Class members as template alias parameters not CTFE-able

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sun Feb 14 16:03:22 PST 2016


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

--- Comment #2 from Martin Krejcirik <mk at krej.cz> ---
Same issue ? static on templated function helps too.

------------------------------------------
int func(T...)()
{
    return 1;
}

class Bug
{
    Stru s;

    this() { }

    int pokus()
    {
        // Error: this for func needs to be type Stru not type strubug.Bug
        return func!(s.a)();
    }
}

void bug()
{
    Stru s;

    int pokus()
    {
        // Error: need 'this' for 'func' of type 'pure nothrow @nogc @safe
int()'
        return func!(s.a)();
    }
}


struct Stru
{
    int a;
    int b;
}
------------------------------------------------

First example compiles with 2.062

--


More information about the Digitalmars-d-bugs mailing list