www.digitalmars.com         C & C++   DMDScript  

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

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

          Issue ID: 21713
           Summary: Cannot write trusted desstructor with  system member
                    dtor
           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() {}
}

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

 safe:
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
yourself.

--
Mar 14