Can't call destroy in nogc context, even though the class destructor being called is marked @nogc

12345swordy via Digitalmars-d digitalmars-d at puremagic.com
Mon Jul 10 07:52:57 PDT 2017


On Monday, 10 July 2017 at 03:41:15 UTC, Lamex wrote:
> On Monday, 10 July 2017 at 01:51:11 UTC, 12345swordy wrote:
>> On Sunday, 9 July 2017 at 17:27:51 UTC, 12345swordy wrote:
>>> I have submitted a bug report regarding this:
>>> https://issues.dlang.org/show_bug.cgi?id=17592
>>>
>>> This is IMO severely limit the usage of emplace and destroy 
>>> when it comes to manual memory management. The solutions that 
>>> I find here involves very hackish solutions which is not idea 
>>> for me.
>>>
>>> Alex
>>
>> No responses!?
>
> dtors not being virtual is the root cause of this issue (note 
> the ctors aren't either but that's a bit different due to how 
> super() works). This cant be fixed easily. Maybe the most 
> simple workaround would be an @assumenogc attribute.

I redundant to create a poor man's destructor void function named 
"clear()" for every class it allocated, every workaround I come 
across here around involves ugly hacks. Even Automem has it's on 
way of calling the destructor in a @nogc context.

Regardless, this is very frustrating for me to do manual memory 
management with class in a @nogc context without resorting to 
hacks and third-party libraries. I hope that the current main 
devs would tackle this in the upcoming releases.




More information about the Digitalmars-d mailing list