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

RazvanN <[email protected]> changed:

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

--- Comment #2 from RazvanN <[email protected]> ---
I don't think this bug report is valid. Since a copy constructor is defined for
S, then all copies that are being made for it need to call a copy constructor.
Since the copy constructor is only defined for mutable destinations, I don't
see how we could safely support the automatic conversion from mutable to
immutable. That would open the door for code like this one:

int* s;

struct S
{
    int p;

    this(const ref S src)
    {
        s = &p;
    }
}

void main()
{
    immutable(S) s1 = S(2);
    immutable(S) s2 = s1;
    writeln(*s2.p);
    *s = 9;
    writeln(*s2.p);
}

--

Reply via email to