[Issue 13628] Error: immutable method S.~this is not callable using a mutable object and vice versa

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Dec 20 16:10:19 UTC 2021


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

anonymous4 <dfj1esp02 at sneakemail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |spec

--- Comment #6 from anonymous4 <dfj1esp02 at sneakemail.com> ---
In the meantime behavior was changed for simplicity or something like that, now
unqualified destructor is always called on unqualified instance, like this:

struct SecureString
{
    char[] secret;
    ~this() { secret[]=0; }
}

int main()
{
    immutable s=immutable SecureString("aa");
    return 0;
}

--


More information about the Digitalmars-d-bugs mailing list