I hate class destructors with a burning passion

Mathias LANG geod24 at gmail.com
Thu Jun 10 00:27:42 UTC 2021


On Sunday, 6 June 2021 at 22:00:32 UTC, tsbockman wrote:
> On Sunday, 6 June 2021 at 11:54:40 UTC, Mathias LANG wrote:
>> We currently have a random crash which seems to trigger when a
>> C++ object is destructed by the GC (to be precise: the GC
>> finalizes a `class` that holds an `std::vector`), but that
>> might just be our bindings...
>
> extern(C++) class support is critically incomplete/buggy right 
> now, even for basic usage that doesn't involve templates or 
> multiple inheritance. Are you aware of these bugs?
>
> Issue 21693 - extern(C++) class instance dtors are never 
> called, breaking RAII:
>     https://issues.dlang.org/show_bug.cgi?id=21693
>
> Issue 21690 - Unable to dynamic cast extern(C++) classes
> (Dynamic casts of extern(C++) classes are silently lowered to 
> unchecked static casts):
>     https://issues.dlang.org/show_bug.cgi?id=2169

Thanks for the pointers. I checked and I don't think we're using 
any of those, luckily. The first one, because we don't allocate 
those objects standalone, we always store them in another object, 
so their dtors are called (hence the bug).
We don't need dynamic cast (we have a few classes called from 
C++) so this is all fine for us.

The major bug that blocked us for a long time was 
https://issues.dlang.org/show_bug.cgi?id=20235 which was fixed in 
v2.096.0.


More information about the Digitalmars-d mailing list