Enum member forward references now work:

void main()
{
    enum E
    {
        A = B,
        E = D + 7,
        B = 3,
        C,
        D,
    }

    assert(E.A == 3);
    assert(E.B == 3);
    assert(E.C == 4);
    assert(E.D == 5);
    assert(E.E == 12);
    assert(E.max == 12);
}

https://github.com/D-Programming-Language/dmd/pull/2568

Once this is pulled, I intend to extend it so that enum members for imports are not semantically evaluated at all unless they are used. This is a first step to making all semantic evaluation of imports lazy, which should give us a big boost in compilation speed, as well as do a much better job at handling forward references.

I've been meaning to do this for some time, starting with enums because they are the easiest.

Reply via email to