Destructor called while object is still alive

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Fri Oct 23 21:55:36 UTC 2020


On Friday, 23 October 2020 at 19:36:38 UTC, H. S. Teoh wrote:
> On Fri, Oct 23, 2020 at 07:23:03PM +0000, frame via 
> Digitalmars-d wrote:
>> On Friday, 23 October 2020 at 17:47:34 UTC, Steven 
>> Schveighoffer wrote:
> [...]
>> > The optimizer is wrong, and should be changed.
>> > 
>> > Note that LDC does not do this optimization.
> [...]
>> So how can I avoid this issue with DMD? Disabling any 
>> optimization? In fact it does not occur with debug mode 
>> enabled.
> [...]
>
> IMNSHO, drop dmd and use ldc2 instead.  Life is too short to 
> have to deal with dmd backend bugs when I'm trying to get 
> things *done*.  This isn't the first time the dmd backend has 
> problems when optimization / inlining are enabled, and I fear 
> it won't be the last.

LDC is better at detecting unreachable code so it actually does 
worse than DMD.

https://run.dlang.io/is/2U5OgM

LDC -O3 fails
DMD -release succeeds






More information about the Digitalmars-d mailing list