https://d.puremagic.com/issues/show_bug.cgi?id=11988
--- Comment #2 from Andrej Mitrovic <[email protected]> 2014-01-24 13:56:44 PST --- (In reply to comment #1) > Why don't we just allow `auto var = <expression>`, like in an if-statement? Because they would have different semantics. The if statement's body is not entered when the expression implicitly converts to false, e.g.: ----- void main() { if (auto x = 0) { assert(0); } // body not entered if (auto x = 1) { } } ----- ----- With a switch you wouldn't want this to happen. For example: void main() { switch (auto x = 0) { case 0: // this must continue to work. } } ----- So you'd end up with different semantics. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
