Bug 1795 – Unreachable code in Phobos std.string

Status
RESOLVED
Resolution
DUPLICATE
Severity
minor
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2008-01-21T12:35:00Z
Last change time
2015-06-09T01:14:30Z
Assigned to
bugzilla
Creator
jemandy

Comments

Comment #0 by jemandy — 2008-01-21T12:35:36Z
The following will not compile with warnings enabled (-w): import std.string; int main() { return 0; } The error is: warning - C:\Apps\DigitalMars\dmd2\src\phobos\std\string.d(1600): Error: stateme nt is not reachable C:\Apps\DigitalMars\dmd2\src\phobos\std\string.d(594): template instance std.str ing.startsWith!(invariant(char)[],invariant(char[1u])) error instantiating Line 1600 is a return statement. Commenting it out and recompiling yields me: warning - C:\Apps\DigitalMars\dmd2\src\phobos\std\string.d(1690): Error: stateme nt is not reachable C:\Apps\DigitalMars\dmd2\src\phobos\std\string.d(609): template instance std.str ing.endsWith!(invariant(char)[],invariant(char[1u])) error instantiating Line 16090 is another return statement. Commenting out both lines 1600 and 1690 allows this to compile correctly.
Comment #1 by torhu — 2008-01-21T23:31:41Z
*** This bug has been marked as a duplicate of 1704 ***