Thread overview
[Issue 1322] New: foreach bypasses invariant
Jul 08, 2007
d-bugmail
Jul 08, 2007
d-bugmail
Sep 03, 2008
d-bugmail
July 08, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1322

           Summary: foreach bypasses invariant
           Product: D
           Version: 2.002
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: Daniel919@web.de


import std.stdio;
void main() {
     invariant(char)[] s = "test";
     foreach (ref char c; s) {
         c = 'a';
         break;
     }
     writefln(s);
}

The output is 'aest' which means that the invariant char array got changed.


-- 

July 08, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1322





------- Comment #1 from Daniel919@web.de  2007-07-08 05:58 -------
Additional thoughts about it: http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=55316


-- 

September 03, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1322


bugzilla@digitalmars.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




------- Comment #2 from bugzilla@digitalmars.com  2008-09-03 01:39 -------
Fixed dmd 2.019


--