www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12981] New: Can't refer to 'outer' from mixin template

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

          Issue ID: 12981
           Summary: Can't refer to 'outer' from mixin template
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: regression
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: public dicebot.lv

This code works in D1 (and prints "B" as expected):

=======
template AAA(T)
{
    class A
    {
        alias typeof(this.outer) x;
    }
}

class B
{
    mixin AAA!(int);

    pragma(msg, A.x);
}

void main() {}
=======

With current git master:

a.d(3): Error: variable this forward referenced
a.d(11): Error: mixin a.B.AAA!int error instantiating
a.d(13):        while evaluating pragma(msg, A.x)

I don't know at which point it stopped working in D2. It has been found during
porting of some of Sociomantic code.

--
Jun 24 2014