digitalmars.D.bugs - [Issue 8773] New: [CTFE] foreach ref element doesn't work well at compile time.
- d-bugmail puremagic.com (42/42) Oct 07 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8773
- d-bugmail puremagic.com (10/10) Oct 08 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8773
- d-bugmail puremagic.com (12/12) Oct 08 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8773
http://d.puremagic.com/issues/show_bug.cgi?id=8773 Summary: [CTFE] foreach ref element doesn't work well at compile time. Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: zan77137 nifty.com --- Comment #0 from SHOO <zan77137 nifty.com> 2012-10-07 01:18:56 PDT --- This code doesn't work well: -------------------------------------- import std.stdio; void foo(ref string[] data) { foreach (ref e; data) { e = e ~ "!"; } } string[] bar(string[] data) { foo(data); return data; } void main() { enum data = ["a", "bcde", "abcde"]; enum resCt = bar(data); auto resRt = bar(data); writeln(resCt); // NG: ["a", "bcde", "abcde"] writeln(resRt); // OK: ["a!", "bcde!", "abcde!"] assert(resCt == resRt); // NG } ------------------------------------- -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 07 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8773 Don <clugdbug yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |clugdbug yahoo.com.au --- Comment #1 from Don <clugdbug yahoo.com.au> 2012-10-08 06:02:34 PDT --- Duplicate of bug 7658? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 08 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8773 SHOO <zan77137 nifty.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |DUPLICATE --- Comment #2 from SHOO <zan77137 nifty.com> 2012-10-08 07:41:36 PDT --- Hm... By all appearance it looks like it. *** This issue has been marked as a duplicate of issue 7658 *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 08 2012