struct destructor

Imperatorn johan_forsberg_86 at hotmail.com
Fri May 21 06:46:42 UTC 2021


On Sunday, 16 May 2021 at 11:42:19 UTC, Adam D. Ruppe wrote:
> On Sunday, 16 May 2021 at 08:04:06 UTC, cc wrote:
>> [...]
>
> destroy + GC.free has a quirk - GC.free only works on what 
> GC.malloc returns, a base pointer, NOT what `new` returns. The 
> documentation says this but it is a subtle detail easy to 
> miss...
>
> ...including by other stdlib authors. __delete is simply 
> incorrectly implemented and an accidental no-op in most cases!
>
> https://issues.dlang.org/show_bug.cgi?id=21550
>
> The documentation that describes how to migrate away from 
> `delete` made this same error.
>
> I tracked down the problem but wasn't 100% sure about the fix. 
> Adding the GC.baseOf thing works for me but i didn't upstream 
> since idk if it works for everyone else.
>
> maybe i should just do it though.

I'd say do it and then >9000 devs will comment, possibly leading 
to the truth. No comments = it's already acceptable.


More information about the Digitalmars-d-learn mailing list