www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8868] New: overload resolution of &x.g() incorrectly chooses delegate over function pointer

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

           Summary: overload resolution of &x.g() incorrectly chooses
                    delegate over function pointer
           Product: D
           Version: D1 & D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: clugdbug yahoo.com.au



..or vice versa.
Reported by kenji in the pull request for bug 8257.
https://github.com/D-Programming-Language/dmd/pull/1194
-----
struct S8257 {
    void g(int n){} // before the static one
    static int g() { return 6; }
}
void main() {
     auto k = &(func()).g;
     pragma(msg, typeof(k));  // prints void delegate(int n)
}

It always chooses the first function declaration.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 22 2012
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8868


Stewart Gordon <smjg iname.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |accepts-invalid
                 CC|                            |smjg iname.com



What is 'func'?  The code shouldn't compile as written.

Otherwise, this looks like a case of issue 52 that the fix doesn't cover.

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