www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12222] New: "alias this" ignored for aliased methods

https://d.puremagic.com/issues/show_bug.cgi?id=12222

           Summary: "alias this" ignored for aliased methods
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P3
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: thecybershadow gmail.com


--- Comment #0 from Vladimir Panteleev <thecybershadow gmail.com> 2014-02-22
07:35:56 EET ---
///// test.d /////
struct S
{
    void f() {}
}

struct W
{
    S s;
    alias s this;
    alias f = s.f;
}

void main()
{
    W w;
    w.f();
}
//////////////////

Compiler complains:

test.d(16,2): Error: this for f needs to be type S not type W

However, there is an "alias this" it W to S which should allow the method to be
called with S as the "this" type.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 21 2014