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

--- Comment #0 from Jesse Phillips <> 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:
------- You are receiving this mail because: -------

Reply via email to