can't get function pointer to static member

BCS BCS at pathlink.com
Mon Jun 5 16:59:16 PDT 2006


All lines of the following program are valid (I think). DMD however 
claims that the last line of foo is invalid (it assumes that &func is a 
delegate).

This fails with both structs and classes

<code>
import std.stdio;

//class Ag
struct Ag
{
	static void func(){}

	static void foo()
	{
		void function() fnp;
		Ag a;
			// valid works
		fnp = &func;
		fnp = &Ag.func;
		with(a)	fnp = &Ag.func;

			// valid don't work
		with(a) fnp = &func;
	}
}
void main(){}
</code>



More information about the Digitalmars-d-bugs mailing list