Copying a variable state in a delegate literal definition
Timon Gehr
timon.gehr at gmx.ch
Fri Sep 2 16:26:59 PDT 2011
On 09/03/2011 01:13 AM, Andrej Mitrovic wrote:
> 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.
So if I get you right, you made the templated version final? Did you try
making the non-templated version final?
>
> 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