www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2787] New: Members found in an 'alias this' are not implicitly accessible in methods

http://d.puremagic.com/issues/show_bug.cgi?id=2787

           Summary: Members found in an 'alias this' are not implicitly
                    accessible in methods
           Product: D
           Version: 2.027
          Platform: PC
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: jarrett.billingsley gmail.com


struct Base
{
        int x;
        void foo() { writefln("%s", x); }
}

struct Derived
{
        Base _base;
        alias _base this;
        int y;
        void bar() { writefln("%s, %s", x, y); }  // line 16
}

foo.d(16): Error: undefined identifier x

But 'this.x' works.


-- 
Apr 02 2009