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; }
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 ***
Thanks I would have never guessed they were the same issue.