https://issues.dlang.org/show_bug.cgi?id=17505

          Issue ID: 17505
           Summary: [REG2.075] @safe constructor requires the
                    deconstructor to be safe as well
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nob...@puremagic.com
          Reporter: greensunn...@gmail.com

cat > main.d << CODE
struct Array
{
    int[] _payload;
    ~this()
    {
        import core.stdc.stdlib : free;
        free(_payload.ptr);
    }
}

class Scanner
{
    Array arr;
    this() @safe {}
}
CODE


$ dmd -main

main.d(14): Error: @safe constructor 'main.Scanner.this' cannot call @system
destructor 'main.Scanner.~this'

--

Reply via email to