www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1795] New: Unreachable code in Phobos std.string

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1795

           Summary: Unreachable code in Phobos std.string
           Product: D
           Version: 2.010
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: minor
          Priority: P2
         Component: Phobos
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: jemandy earthlink.net


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.


-- 
Jan 21 2008
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1795


torhu yahoo.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE







*** This bug has been marked as a duplicate of 1704 ***


-- 
Jan 21 2008