www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21713] New: Cannot write trusted desstructor with system


          Issue ID: 21713
           Summary: Cannot write trusted desstructor with  system member
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: tobias pankrath.net

See here: https://run.dlang.io/is/DLtrxB
And here: https://gist.github.com/run-dlang/b8eb31340c90c128a12b31a7c7e18804
struct Foo
     system ~this() {}

struct Bar
    Foo f;
    ~this()  trusted {}

void main()
    Bar b;

It should be possible to declare that I indeed trust the transitively called
 system dtors.

You can circumvent that by putting the field into a union and destruct it

Mar 14 2021