Bug 17592 – destroy isn't marked @nogc when the class destructor is marked as @nogc

Status
RESOLVED
Resolution
DUPLICATE
Severity
major
Priority
P1
Component
druntime
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-07-03T22:56:23Z
Last change time
2020-03-21T03:56:37Z
Assigned to
No Owner
Creator
alexanderheistermann

Comments

Comment #0 by alexanderheistermann — 2017-07-03T22:56:23Z
Here is the pseudocode example: @nogc class TestClass { int x; @nogc this(int x) { this.x = x; } @nogc~this() { } } @nogc void main() { //created a testclass object name obj using emplace and malloc destroy(obj);//Error occurs here free(cast(void*)obj); } This is very frustrating for manual memory management by using emplace, destroy, malloc and free functions in @nogc context. Based on the memory management example named "Explicit Class Instance Allocation" on the official dlang website. Possible related to: https://issues.dlang.org/show_bug.cgi?id=17297
Comment #1 by simen.kjaras — 2017-10-03T13:39:02Z
*** Issue 16064 has been marked as a duplicate of this issue. ***
Comment #2 by simen.kjaras — 2018-02-07T12:51:14Z
*** This issue has been marked as a duplicate of issue 15246 ***