[Issue 17592] New: destroy isn't marked @nogc when the class destructor is marked as @nogc

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Jul 3 15:56:23 PDT 2017


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 at puremagic.com
          Reporter: alexanderheistermann at 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

--


More information about the Digitalmars-d-bugs mailing list