Copying a variable state in a delegate literal definition

Andrej Mitrovic andrej.mitrovich at gmail.com
Fri Sep 2 16:13:31 PDT 2011


On 9/3/11, Timon Gehr <timon.gehr at gmx.ch> wrote:
> What happens if you declare the function final?

Doesn't help. But it has to be virtual as every object needs to have
it's own set of delegates.

And wow, it seems to be random as well. If I do this:

    @property void connect(Signal signal = Signal.MouseClick)(void
delegate() dg)
    {
        writeln(&dg);
        clickHandlers ~= dg;
    }

It won't crash. But if I comment out the writeln() call it crashes
with an access violation. I've tested this a few dozen times. This
definitely looks like a compiler bug. But I have to reduce it first
before I file it.


More information about the Digitalmars-d-learn mailing list