Delegate is left with a destroyed stack object
Timon Gehr
timon.gehr at gmx.ch
Thu Oct 31 09:23:16 PDT 2013
On 10/31/2013 01:46 AM, Xiaoxi wrote:
>>
>>
>> =====
>> The combination of closure variables + scoped destruction should
>> be rejected, but currently it isn't. It's a compiler bug.
>>
>> http://d.puremagic.com/issues/show_bug.cgi?id=11382
>>
>> Kenji Hara
>> =====
>>
>> Ali
>
> kenji is right.
I think nobody is 'right' here.
> compilation error is the only safe approach, if you do
> not wish scoped destruction, don’t request it in the first place!
Destruction is implicit and it is possible to allocate structs on the
heap anyway.
> dangerous operations like this should be explicit to avoid surprises,
> not hidden in complicared implicit special cases.
If failing compilation is the way to go, avoiding special cases is not
why. Erroring out here is a special case.
More information about the Digitalmars-d
mailing list