[Issue 4501] New: Can't call templated properties as properties from within class

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Jul 24 09:48:25 PDT 2010


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

           Summary: Can't call templated properties as properties from
                    within class
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: dsimcha at yahoo.com


--- Comment #0 from David Simcha <dsimcha at yahoo.com> 2010-07-24 09:48:24 PDT ---
class Foo {
    int _num;

    int num()()  {
        return _num;
    }

    void doStuff() {
        int i = num;  // Broken
    }
}

void main() {
    auto foo = new Foo;
    auto n = foo.num;  // Works
}


Errors:
test9.d(8): Error: template num() has no value
test9.d(8): Error: cannot implicitly convert expression (num()) of type void to
int

If I comment out Foo.doStuff(), the line `auto n = bar.num;` works, apparently
becuase it's not inside the class.

-- 
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