https://issues.dlang.org/show_bug.cgi?id=17867
Issue ID: 17867
Summary: @trusted destructor not callable from @safe function
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: [email protected]
Reporter: [email protected]
Consider:
struct S
{
@system ~this() {}
}
struct T
{
S member;
@trusted ~this() {}
}
@safe void main()
{
T obj;
}
This code should work because although the member's destructor is @system, the
object containing it makes it safe. The code fails with:
Error: @safe function 'D main' cannot call @system destructor 'test.T.~this'
Couldn't find a convenient workaround.
--