Bug 14365 – DMD should error or warn on SDC test0173.d

Status
RESOLVED
Resolution
INVALID
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Mac OS X
Creation time
2015-03-28T17:02:00Z
Last change time
2015-06-09T05:14:46Z
Assigned to
nobody
Creator
shammah.chancellor

Comments

Comment #0 by shammah.chancellor — 2015-03-28T17:02:48Z
``` > ../bin/sdc test0173.d return 7; ^~~~~~~~~ test0173.d:13: error: Unreachable statement. ``` ```test0173.d //T compiles:no //T has-passed:yes // Unreachable statement int main() { int i = 5; if (i) { return 3; } else { return 5; } return 7; } ```
Comment #1 by ketmar — 2015-03-28T17:38:53Z
it does: z00.d(9): Warning: statement is not reachable
Comment #2 by shammah.chancellor — 2015-03-28T17:43:07Z
Why are warnings not being printed by default?
Comment #3 by ketmar — 2015-03-28T18:15:26Z
i believe that this is a historic thingy. almost any C compiler is silent by default, do did DMD. i think it worth ER, as there is no same reason to not print warnings by default.
Comment #4 by k.hara.pg — 2015-03-29T04:23:57Z
DMD actually report "statement is not reachable" warning with -w switch. So this is an invalid issue.