www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17592] New: destroy isn't marked nogc when the class

https://issues.dlang.org/show_bug.cgi?id=17592

          Issue ID: 17592
           Summary: destroy isn't marked  nogc when the class destructor
                    is marked as  nogc
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: blocker
          Priority: P1
         Component: druntime
          Assignee: nobody puremagic.com
          Reporter: alexanderheistermann gmail.com

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

--
Jul 03 2017