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

           Summary: implicit conversion to const rules need tightening
           Product: D
           Version: 2.036
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: bugzi...@digitalmars.com


--- Comment #0 from Walter Bright <bugzi...@digitalmars.com> 2009-12-16 
13:28:09 PST ---
The following allows a write to an immutable array:

import std.stdio;

void doSomething(const(char)[][] a, const(char)[][] b)
{
    a[0]=b[0];
}

void main()
{
    string s = "hello";
    char[][1] a;
    string[1] b;
    b[0] = s;
    doSomething(a, b);
    a[0][1] = 'c';   // OOPS!
    writeln(s);
}

So, a conversion to const that is not the top ref should be disallowed.

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

Reply via email to