Destructor called while object is still alive

frame frame86 at live.com
Fri Oct 23 19:23:03 UTC 2020


On Friday, 23 October 2020 at 17:47:34 UTC, Steven Schveighoffer 
wrote:
> On 10/23/20 12:48 PM, Ola Fosheim Grøstad wrote:
>> On Friday, 23 October 2020 at 16:30:52 UTC, Steven 
>> Schveighoffer wrote:
>>> No, D classes map to C++ pointers to classes.

> It doesn't have to even have a pointer if it's never used.
> ...
> The optimizer is wrong, and should be changed.
>
> Note that LDC does not do this optimization.
>
> -Steve

So how can I avoid this issue with DMD? Disabling any 
optimization? In fact it does not occur with debug mode enabled.

scope doesn't change a thing.

Actually I do use the pointer in real code, (just one method call 
before a loop but still used).



More information about the Digitalmars-d mailing list