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



--- Comment #9 from Stewart Gordon <s...@iname.com> 2011-06-16 12:12:23 PDT ---
(In reply to comment #5)
>>> immutable(T*)** => const(T*)** allowed, same number of mutable indirections

As it turns out, this is unsafe, as the following code shows:

----------
import std.stdio;

void main() {
    immutable(int) i = 42;
    immutable(int)* ip = &i;
    immutable(int)** ipp = &ip;
    const(int)** cpp = ipp;

    int m = 69;
    // the next statement makes ip point to a mutable value!
    *cpp = &m;

    writefln("%d", *ip);
    m = 105;
    writefln("%d", *ip);
}

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

Reply via email to