[Issue 5392] New: Method with template this parameter doesn't work as a property

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Dec 30 14:09:09 PST 2010


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

           Summary: Method with template this parameter doesn't work as a
                    property
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Mac OS X
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: doob at me.com


--- Comment #0 from Jacob Carlborg <doob at me.com> 2010-12-30 14:07:00 PST ---
The following code fails to compile:

class A
{
    T foo (this T) ()
    {
        return new T;
    }
}

class B : A { }

void main ()
{
    auto b = new B;
    B b2 = b.foo;
}

With the error message:
main.d(16): Error: b.foo(this T) has no value

This code works:

auto b2 = b.foo; // using auto
B b2 = b.foo(); // using parentheses

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


More information about the Digitalmars-d-bugs mailing list