[Issue 11291] New: Disallow mutation of a const variable

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Oct 18 03:07:05 PDT 2013


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

           Summary: Disallow mutation of a const variable
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: accepts-invalid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2013-10-18 03:07:03 PDT ---
With dmd 2.064beta2 this gives no compile-time errors:


import std.range: zip;
void main() {
    foreach (const a, const b; zip(["foo"], ["bar"])) {
        a = "something";
    }
}


But I expect it to give a "cannot modify const expression a" error.

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


More information about the Digitalmars-d-bugs mailing list