http://d.puremagic.com/issues/show_bug.cgi?id=4338


Andrei Alexandrescu <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]


--- Comment #6 from Andrei Alexandrescu <[email protected]> 2012-01-17 
21:13:29 PST ---
With the current 2.058 from head the code compiles. But it shouldn't because
it's unsound.

Mutable destructors shouldn't apply to objects that were immutable, otherwise
they can mutate immutable objects. Consider:

struct A {
    int* p;
    ~this() { *p = 5; }
}

void main() {
    auto p = new immutable(int);
    { auto a = immutable(A)(p); }
    assert(*p == 0);
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to