Thread overview
[Issue 11291] New: Disallow mutation of a const variable
Oct 18, 2013
Kenji Hara
Nov 03, 2013
yebblies
October 18, 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@puremagic.com
        ReportedBy: bearophile_hugs@eml.cc


--- Comment #0 from bearophile_hugs@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: -------
October 18, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=11291


Kenji Hara <k.hara.pg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull
           Platform|x86                         |All
         OS/Version|Windows                     |All


--- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> 2013-10-18 04:35:45 PDT ---
https://github.com/D-Programming-Language/dmd/pull/2678

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 18, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=11291



--- Comment #2 from bearophile_hugs@eml.cc 2013-10-18 04:49:25 PDT ---
You are really good Kenji.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 03, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=11291



--- Comment #3 from github-bugzilla@puremagic.com 2013-11-03 08:26:50 PST ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/d826696f214166a07371c4401e3a1d6e27bd5082 fix Issue 11291 - Disallow mutation of a const variable

https://github.com/D-Programming-Language/dmd/commit/1c0f7a2c7cc4943076d5bd5d30c31dc19fd7ef0b Merge pull request #2678 from 9rnsr/fix11291

Issue 11291 - Disallow mutation of a const variable

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 03, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=11291


yebblies <yebblies@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |yebblies@gmail.com
         Resolution|                            |FIXED


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