D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6287 - function pointers to non-static function without an object-instance
Summary: function pointers to non-static function without an object-instance
Status: RESOLVED DUPLICATE of issue 3720
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: Other Windows
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-11 09:32 UTC by Zoadian
Modified: 2011-07-11 09:44 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Zoadian 2011-07-11 09:32:15 UTC
----
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 yebblies 2011-07-11 09:44:12 UTC

*** This issue has been marked as a duplicate of issue 3720 ***