Exceptions in @nogc code
Guillaume Piolat via Digitalmars-d
digitalmars-d at puremagic.com
Sun Apr 2 13:21:20 PDT 2017
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.
More information about the Digitalmars-d
mailing list