Code doesn't compile

Adam D. Ruppe destructionator at gmail.com
Fri Jul 5 07:35:53 PDT 2013


On Friday, 5 July 2013 at 11:23:55 UTC, Mohammad Sadegh Khoeini 
wrote:
>   // auto u = Foo!(&b.fun)();  // doesn't work: vaiable b 
> cannot be read at compile time
>   // auto v = Foo!(Baz!int.fun!int)();  //doesn't work: this 
> for fun needs to be type Baz not type Foo!(fun)

Not a bug, I think at least, getting the address needs to be done 
at runtime and delegates need an address. The reason the literal 
works is literals can cheat at figuring out its variables.

Wrapping it like you did for variable f is the easiest way to 
make it work.


More information about the Digitalmars-d mailing list