digitalmars.D.bugs - [Issue 14486] New: delete on classes ignores nogc
- via Digitalmars-d-bugs (36/36) Apr 23 2015 https://issues.dlang.org/show_bug.cgi?id=14486
https://issues.dlang.org/show_bug.cgi?id=14486 Issue ID: 14486 Summary: delete on classes ignores nogc Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: minor Priority: P1 Component: DMD Assignee: nobody puremagic.com Reporter: ketmar ketmar.no-ip.org the following code gives error: "cannot use 'delete' in nogc function main" class Foo { nogc this () {} trusted nothrow nogc new (size_t size) { import core.stdc.stdlib : malloc; auto res = malloc(size); if (res is null) { import core.exception : onOutOfMemoryError; onOutOfMemoryError(); } return res; } nothrow nogc delete (void* p) { import core.stdc.stdlib : free; free(p); } } void main () nogc { auto f = new Foo(); delete f; } compiler doesn't check if class has overload `delete` marked as ` nogc`. --
Apr 23 2015