Copying a variable state in a delegate literal definition
Andrej Mitrovic
andrej.mitrovich at gmail.com
Fri Sep 2 11:46:12 PDT 2011
Damn it looks like I've ran into some template bug as well.
With this:
@property void connect(Signal signal = Signal.MouseClick)(void
delegate() dg)
{
clickHandlers ~= dg;
}
and a call like this:
item.connect = { this.showMenu(0); };
this crashes with an access violation. But if I change connect to be a
regular function:
@property void connect(void delegate() dg)
{
clickHandlers ~= dg;
}
Then it works properly. Hmmm...
More information about the Digitalmars-d-learn
mailing list