www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1646] New: method overloaded on delegate and function matches both in certain cases

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1646

           Summary: method overloaded on delegate and function matches both
                    in certain cases
           Product: D
           Version: 2.007
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: schveiguy yahoo.com


The following code produces the issue:

class A
{
  void f1(void delegate() dg)
  {
  }

  void f1(void function() dg)
  {
  }
}

class C
{
  this()
  {
    A a = new A;
    a.f1(&x);
  }
  void x()
  {
  }
}

The call to f1 should only match the delegate version because x requires a
context pointer.  This was the behavior on D 1.0.

A workaround exists, if you change the line to:

a.f1(&this.x);


-- 
Nov 07 2007
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1646


schveiguy yahoo.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED





This issue appears to be fixed in D 2.015 and 2.016


-- 
Jul 10 2008