May 20, 2006 [Bug 148] New: Incorrect "statement is not reachable" warning with goto and for loop | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/bugzilla/show_bug.cgi?id=148 Summary: Incorrect "statement is not reachable" warning with goto and for loop Product: D Version: 0.157 Platform: PC OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla@digitalmars.com ReportedBy: chris@inventivedingo.com ====== testbug.d ======= import std.stdio, std.string; void main() { int i=0; writef("This number is zero: "); goto inloop; for(; i<10; i++) { // this is line 7 writef("This number is nonzero: "); inloop: writefln(toString(i)); } } ====== ====== D:\D>dmd testbug.d -w warning - testbug.d(7): statement is not reachable ======== A warning is generated on the line of the for loop, but that statement will of course will be executed when the loop loops. Workarounds: - Compile without warnings - Change line 6 to: if (1) goto inloop; -- |
June 05, 2006 [Bug 148] Incorrect "statement is not reachable" warning with goto and for loop | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/bugzilla/show_bug.cgi?id=148 bugzilla@digitalmars.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED ------- Comment #1 from bugzilla@digitalmars.com 2006-06-04 22:15 ------- Fixed in DMD 0.160 -- |
Copyright © 1999-2021 by the D Language Foundation