Bug 7203 – Method pointer types differ depending on context

Status
RESOLVED
Resolution
INVALID
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
All
Creation time
2012-01-02T12:23:00Z
Last change time
2012-01-02T21:48:08Z
Assigned to
nobody
Creator
robert

Comments

Comment #0 by robert — 2012-01-02T12:23:09Z
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.
Comment #1 by k.hara.pg — 2012-01-02T21:48:08Z
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 } }