On 04/08/2017 11:59 PM, Meta wrote:
enum a = 0;

template test1()
{
    enum b1 = a; //Okay, a is in scope at the declaration site
    //enum c = d1; Error: undefined identifier d1

This line works just fine, actually. There's really no difference between a normal template and a mixin template when you use it in a mixin.

}

mixin template test2()
{
    enum b2 = a; //Okay, a is in scope at the declaration site
    enum c = d1; //Okay, d1 is in scope at the *instantiation* site
    //enum e = d2; Error: undefined identifier d2
}

void main()
{
    enum d1 = 0; //<--d1 is declared here
    mixin test1!();
    mixin test2!(); //<--so it is in scope here
    enum d2 = 0; //d2 was not declared before test2 was mixed in
                     //so it is not in scope for test2
}

Reply via email to