www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 7203] New: Method pointer types differ depending on context

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

           Summary: Method pointer types differ depending on context
           Product: D
           Version: D2
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: robert octarineparrot.com



20:23:09 GMT ---
class A {
  void foo() {
    pragma(msg, typeof(&A.foo).stringof);
  }
}
pragma(msg, typeof(&A.foo).stringof);

This produces:
----
void function()
void delegate()
----

However it should produce void function() in both cases.

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


Kenji Hara <k.hara.pg gmail.com> changed:

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



In non-static member function of A, A.foo is implicitly translated to this.foo.
So in function foo, typeof(&A.foo) == typeof(this.foo) and it is delegate type.

class A {
  void foo() {
    A.foo();  // recursive call
  }
}

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