Bug 2793 – Unreachable code in Phobos std.algorithm sort
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P3
Component
phobos
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2009-04-03T14:07:00Z
Last change time
2015-06-09T01:18:23Z
Keywords
rejects-valid
Assigned to
bugzilla
Creator
gide
Comments
Comment #0 by gide — 2009-04-03T14:07:18Z
The following code does not compile with warnings enabled (-w). Commenting out src\phobos\std\algorithm.d lines 2119 and 2121 fixes the issue.
import std.algorithm;
void main() {
int[] a = [1, 2, 3];
sort(a);
}
C:> dmd -w test.d
warning - C:\D\dmd\windows\bin\..\..\src\phobos\std\algorithm.d(2119): Error: statement is not reachable
C:\D\dmd\windows\bin\..\..\src\phobos\std\algorithm.d(2504): template instance std.algorithm.sortImpl!(binaryFun,ss,iterSwap,int[]).sortImpl.partition!(pred,ss,iterSwap,int[]) error instantiating