char[] foo (int bar) { switch (bar) { case 1: return "1"; case 2: return "2"; default: return "many"; } } Compiling this gives the following incorrect error message: C:\programs>dmd -w test.d warning - test.d(1): function test.foo no return at end of function Severity is minor because there are at least 3 easy workarounds: Use if-else. Assign to a temporary variable and return that outside of the switch. Place a return immediately after the switch.
Probably part of the same bug: If you add a statement after the switch, it fails to report "statement is not reachable".
*** Bug 1169 has been marked as a duplicate of this bug. ***
seems this code compiles fine in dmd 1.031
sorry ... it's a warning related issue...reopened
Fixed dmd 1.032 and 2.016
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル