digitalmars.D.bugs - can't get function pointer to static member
- BCS <BCS pathlink.com> Jun 05 2006
- Thomas Kuehne <thomas-dloop kuehne.cn> Jun 29 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>
Jun 05 2006
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 BCS schrieb am 2006-06-05: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>
Added to DStress as http://dstress.kuehne.cn/run/f/function_07_A.d http://dstress.kuehne.cn/run/f/function_07_B.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFEo6jd3w+/yD4P9tIRArpWAJ40Zqz8rj9dBC2JT6pbGRLWRpSd2ACdGwrS 8zqMExAH7mt6yzyS6r7gxFg= =PRkX -----END PGP SIGNATURE-----
Jun 29 2006








Thomas Kuehne <thomas-dloop kuehne.cn>