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: [email protected]
ReportedBy: [email protected]
CC: [email protected]
--- Comment #0 from Jesse Phillips <[email protected]> 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: -------