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

           Summary: inconsistent behavior when taking reference to member
                    without instance
           Product: D
           Version: 1.037
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzi...@digitalmars.com
        ReportedBy: d...@brian.codekitchen.net


See attached test case. When the current context has no 'this', taking a
reference to a member function works correctly. However inside another class'
instance method, the same code throws an error, seemingly trying to
automatically apply the current 'this' even though I'm trying to take a
function, not a delegate.

The inconsistent behavior is buggy. I would argue towards allowing the
reference to be taken in the 'this' instance, since it can be useful when
building up delegates as shown in the test case. Obviously pointless here, but
I discovered the bug when trying to refactor my code for walking over a
collection calling a given method after applying a filtering function, so there
is real-world call for doing this.


-- 

Reply via email to