July 08, 2009 [Issue 3154] New: foreach corrupting data returned by ref functions. | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=3154 Summary: foreach corrupting data returned by ref functions. Product: D Version: 2.031 Platform: Other OS/Version: Linux Status: NEW Severity: major Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: kovrov+puremagic@gmail.com void main() { auto test = Foo(3); foreach (i; test.items) { } } struct Foo { struct Generator { int opApply(int delegate(ref long) dg) { const bak = this.foo.data; // control copy int res; for (long i=0; i < bak; i++) { assert (bak == this.foo.data, "this.foo changed?!"); res = dg(i); if (res) break; } return res; } Foo foo; } ref Generator items() // ref is important { return Generator(this); // Generator.foo = this } int data; } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
May 07, 2010 [Issue 3154] foreach corrupting data returned by ref functions. | ||||
---|---|---|---|---|
| ||||
Posted in reply to kovrov+puremagic@gmail.com | http://d.puremagic.com/issues/show_bug.cgi?id=3154 Don <clugdbug@yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |wrong-code Status|NEW |RESOLVED CC| |clugdbug@yahoo.com.au Resolution| |FIXED --- Comment #1 from Don <clugdbug@yahoo.com.au> 2010-05-06 23:53:17 PDT --- Fixed DMD 2.034. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation