[Issue 14878] New: destructor of lambda parameter not included in speculative @safe check
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Thu Aug 6 04:25:57 PDT 2015
https://issues.dlang.org/show_bug.cgi?id=14878
Issue ID: 14878
Summary: destructor of lambda parameter not included in
speculative @safe check
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: code at dawg.eu
cat > bug.d << CODE
struct T
{
~this() @system {}
}
static assert(!__traits(compiles, (T) @safe {}));
static assert(!is(typeof((T) @safe {})));
CODE
----
This is an idiom that emerged from working on dup [¹] to quickly check whether
a struct has a @safe dtor or postblit.
The postblit check `__traits(compiles, (T b) { T a = b;})` works fine.
[¹]:
https://github.com/D-Programming-Language/druntime/blob/ab41e5ec1e89135b9aa9811f28f07dcf46112b82/src/object.d#L3166
--
More information about the Digitalmars-d-bugs
mailing list