← Back to index
|
Original Bugzilla link
Bug 1322 – foreach bypasses invariant
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2007-07-08T05:54:00Z
Last change time
2015-06-09T01:04:59Z
Keywords
accepts-invalid
Assigned to
bugzilla
Creator
Daniel919
Comments
Comment #0
by Daniel919 — 2007-07-08T05:54:00Z
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.
Comment #1
by Daniel919 — 2007-07-08T05:58:04Z
Additional thoughts about it:
http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=55316
Comment #2
by bugzilla — 2008-09-03T01:39:51Z
Fixed dmd 2.019