Bug 21872 – Warning: statement is not reachable should be error instead of warning!
Status
RESOLVED
Resolution
INVALID
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Mac OS X
Creation time
2021-04-28T05:35:54Z
Last change time
2021-04-28T06:28:25Z
Assigned to
No Owner
Creator
mw
Comments
Comment #0 by mingwu — 2021-04-28T05:35:54Z
Currently the compiler will *stop* after issue this warning:
```
Warning: statement is not reachable
```
This should be made as error, instead of warning.
warning: compiler continue to work.
error: compiler stop.
Comment #1 by dlang-bugzilla — 2021-04-28T06:28:25Z
(In reply to mw from comment #0)
> Currently the compiler will *stop* after issue this warning:
>
> ```
> Warning: statement is not reachable
> ```
With `-wi`, it does not in fact stop:
------------------------------------------------------
$ cat test.d
import std.stdio;
void main()
{
writeln("Hello");
return;
writeln("World");
}
$ dmd -wi -run test.d
test.d(7): Warning: statement is not reachable
Hello
------------------------------------------------------
Please clarify.