[Issue 14487] New: 'new' and 'delete' declarations doesn't accept postfix attributes
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Thu Apr 23 22:19:32 PDT 2015
https://issues.dlang.org/show_bug.cgi?id=14487
Issue ID: 14487
Summary: 'new' and 'delete' declarations doesn't accept postfix
attributes
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: minor
Priority: P1
Component: DMD
Assignee: nobody at puremagic.com
Reporter: ketmar at ketmar.no-ip.org
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;
}
--
More information about the Digitalmars-d-bugs
mailing list