[Issue 21713] New: Cannot write trusted desstructor with @system member dtor

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Mar 14 09:04:05 UTC 2021


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

--


More information about the Digitalmars-d-bugs mailing list