Thread overview | |||||
---|---|---|---|---|---|
|
May 19, 2010 [Issue 4209] New: Can not return from foreach over associative array | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=4209 Summary: Can not return from foreach over associative array Product: D Version: 2.041 Platform: x86 OS/Version: Windows Status: NEW Keywords: wrong-code Severity: major Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: Jesse.K.Phillips+D@gmail.com CC: Jesse.K.Phillips+D@gmail.com --- Comment #0 from Jesse Phillips <Jesse.K.Phillips+D@gmail.com> 2010-05-19 09:55:33 PDT --- The code below demonstrates that even though the function can only return 'false' it will return 'true' This is with DMD 2.043 void main() { assert(success() == false); } bool success() { auto arr = ["Hello":"Misty", "There":"Cats"]; foreach(a; arr) if(a == "Cats") { return false; } else if(a == "Misty") { } else assert(false, "Should never get here."); return true; } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
May 19, 2010 [Issue 4209] Can not return from foreach over associative array | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jesse Phillips | http://d.puremagic.com/issues/show_bug.cgi?id=4209 Steven Schveighoffer <schveiguy@yahoo.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |schveiguy@yahoo.com Resolution| |DUPLICATE --- Comment #1 from Steven Schveighoffer <schveiguy@yahoo.com> 2010-05-19 10:15:28 PDT --- This was recently fixed in 2.046. Building your code with 2.046 compiles and runs as expected (no assertion). *** This issue has been marked as a duplicate of issue 4184 *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
May 19, 2010 [Issue 4209] Can not return from foreach over associative array | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jesse Phillips | http://d.puremagic.com/issues/show_bug.cgi?id=4209 --- Comment #2 from Jesse Phillips <Jesse.K.Phillips+D@gmail.com> 2010-05-19 13:59:09 PDT --- Thanks I would have never guessed they were the same issue. -- 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