Bug 14487 – 'new' and 'delete' declarations doesn't accept postfix attributes

Status
RESOLVED
Resolution
WONTFIX
Severity
minor
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-04-24T05:19:32Z
Last change time
2021-09-08T12:36:38Z
Assigned to
No Owner
Creator
Ketmar Dark

Comments

Comment #0 by ketmar — 2015-04-24T05:19:32Z
the following code raises alot of errors, 'cause compiler doesn't parse postfix attributes on `new` and `delete` declarations: class Foo { @nogc this () {} new (size_t size) @trusted nothrow @nogc { import core.stdc.stdlib : malloc; auto res = malloc(size); if (res is null) { import core.exception : onOutOfMemoryError; onOutOfMemoryError(); } return res; } delete (void* p) nothrow @nogc { import core.stdc.stdlib : free; free(p); } } void main () { auto f = new Foo(); delete f; }
Comment #1 by dkorpel — 2021-09-08T12:36:38Z
class allocators were deprecated in 2.080.1, made an error in 2.087.1, and now removed.