Thread overview
[Issue 3621] New: implicit conversion to const rules need tightening
Dec 16, 2009
Walter Bright
Dec 17, 2009
Leandro Lucarella
Dec 17, 2009
Sobirari Muhomori
Dec 17, 2009
Stewart Gordon
Dec 31, 2009
Walter Bright
December 16, 2009
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: nobody@puremagic.com
        ReportedBy: bugzilla@digitalmars.com


--- Comment #0 from Walter Bright <bugzilla@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: -------
December 17, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3621


Leandro Lucarella <llucax@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |llucax@gmail.com


--- Comment #1 from Leandro Lucarella <llucax@gmail.com> 2009-12-16 16:17:10 PST ---
http://www.dsource.org/projects/dmd/changeset/299

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 17, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3621



--- Comment #2 from Sobirari Muhomori <dfj1esp02@sneakemail.com> 2009-12-17 03:12:12 PST ---
Definitely duplicate of bug 2544.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 17, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3621


Stewart Gordon <smjg@iname.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |smjg@iname.com
         Resolution|                            |DUPLICATE


--- Comment #3 from Stewart Gordon <smjg@iname.com> 2009-12-17 03:34:15 PST ---
I must've assumed every account on this bugzilla had the editbugs bit set....

*** This issue has been marked as a duplicate of issue 2544 ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 31, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3621



--- Comment #4 from Walter Bright <bugzilla@digitalmars.com> 2009-12-31 11:21:33 PST ---
Fixed dmd 2.038

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