Enhancements can enable memory-safe reference counting

Paul Backus snarwin at gmail.com
Thu May 27 00:05:24 UTC 2021


On Wednesday, 26 May 2021 at 22:06:27 UTC, tsbockman wrote:
> On Wednesday, 26 May 2021 at 21:48:40 UTC, Paul Backus wrote:
>> On Wednesday, 26 May 2021 at 18:53:21 UTC, vitoroak wrote:
>>
>> In theory, these examples are fine, since they result in a 
>> null dereference,
>
> No. That's what I thought at first, too, but if you walk 
> through the code more carefully you will see that `x1` never 
> gets set to `null`, and still points to the old target of `u1`. 
> So, he is correct.
>
> I've opened [issue 
> #21981](https://issues.dlang.org/show_bug.cgi?id=21981) 
> requesting a fix.

Thanks, I see the problem now.

I guess the conclusion we're forced to come to is that, given 
current language rules, it is incorrect to mark the destructor as 
`@trusted`.


More information about the Digitalmars-d mailing list