Bug 13201 – Wrong "Warning: statement is not reachable" error with -w
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-07-24T17:04:00Z
Last change time
2014-08-22T08:05:11Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
dragoscarp
Comments
Comment #0 by dragoscarp — 2014-07-24T17:04:20Z
Following code compiled with "-w" produces error (sic!)
"Warning: statement is not reachable"
on the line of the second "break" statement.
Without "-w", it compiles with no message and the executable runs and
exits imediately as expected.
------------------------------
void foo()
{
}
void main()
{
while (true)
{
do
{
foo;
break;
} while (true);
break;
}
}
Comment #1 by dragoscarp — 2014-07-30T10:40:28Z
Upgraded it to regression because following code successfully compiles with dmd-2.065 (-w flag) and with dmd-2.066.0-b6 (-w flag) produces "Warning: statement is not reachable" on "synchronized" line.
==============================
class Foo
{
}
class Bar
{
Foo foo()
{
synchronized
{
assert(0);
}
}
}