Illegal code is accepted in static if, but not in enum declarations. This leads to having three lines when one is enough. Is this just an oversight, or by design?

template T(alias A) {
    enum T = true;
}

void main() {
    struct S { }
    static if(__traits(compiles, S.a) && T!(S.a)) // ok
        enum e1 = true;
    else
        enum e1 = false;
enum e2 = __traits(compiles, S.a) && T!(S.a); // No property S.a
}

Reply via email to