Looks correct to me. This const annotation does not prevent you from deleting memory or free'ing external resources - but it does ensure no transitive mutations for data reachable from struct fields. If it allowed destroying with mutable destructor, type system hole like this would be legal:

struct S
{
    char[] str;
    ~this() { str[0] = 'a'; }
}

auto s = new const S("abcd");
destroy(s); // mutates immutable literal

Reply via email to