www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14878] New: destructor of lambda parameter not included in

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

--
Aug 06 2015