Bug 6287 – function pointers to non-static function without an object-instance

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2011-07-11T09:32:00Z
Last change time
2011-07-11T09:44:12Z
Assigned to
nobody
Creator
suicidenet

Comments

Comment #0 by suicidenet — 2011-07-11T09:32:15Z
---- import std.stdio; struct test { int foo(int k) //forgot to defined as static { return k; } } int main(string[] argv) { int function(int) fp; fp = &test.foo; //this should not be possible, as foo is not static. it allows dirty hacks, though. int x = fp(99); writeln(x); return 0; } ----
Comment #1 by yebblies — 2011-07-11T09:44:12Z
*** This issue has been marked as a duplicate of issue 3720 ***