[Issue 17505] New: [REG2.075] @safe constructor requires the deconstructor to be safe as well
    via Digitalmars-d-bugs 
    digitalmars-d-bugs at puremagic.com
       
    Wed Jun 14 17:20:53 PDT 2017
    
    
  
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: nobody at puremagic.com
          Reporter: greensunny12 at 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'
--
    
    
More information about the Digitalmars-d-bugs
mailing list