Exceptions in @nogc code

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Mon Apr 3 14:28:39 PDT 2017


On 4/2/17 4:21 PM, Guillaume Piolat wrote:
> On Sunday, 2 April 2017 at 17:22:11 UTC, Andrei Alexandrescu wrote:
>> On 4/1/17 2:56 PM, Guillaume Piolat wrote:
>>> The other @nogc blocker is .destroy
>>
>> How do you mean that? -- Andrei
>
> https://github.com/dlang/druntime/blob/master/src/object.d#L2732
>
> destroy() infers it's "@nogc"-ness from rt_finalize which is not nothrow
> and not @nogc:
> https://github.com/dlang/druntime/blob/5a94816c8f1d5c225e560151cebe0a09949896a5/src/object.d#L16
>
>
> I guess the rationale is that rt_finalize call Object.~this() and that
> may GC allocate, and throw.
>
> In turn this cause every wrapper using emplace+destroy to not be @nogc.

Got it. Could you please create an issue about this? -- Andrei


More information about the Digitalmars-d mailing list