Bug 4345 – std.range.take!string: "Nonsensical finite range with slicing but no length"

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
Other
OS
Mac OS X
Creation time
2010-06-19T05:39:00Z
Last change time
2010-08-16T16:52:08Z
Assigned to
nobody
Creator
michel.fortin

Comments

Comment #0 by michel.fortin — 2010-06-19T05:39:44Z
This code triggers a static assert called "Nonsensical finite range with slicing but no length" in std.range.take!string: string str = "abcdef"; string result = str.take(3); assert(array(result) == "abc"); It probably has something to do with strings which have no length defined to so they work with code units instead of code points.
Comment #1 by dsimcha — 2010-08-16T16:51:03Z
Fixed SVN.
Comment #2 by bearophile_hugs — 2010-08-16T16:52:08Z
David, are you trying to fix all Phobos by yourself? Leave some work to the others, please ;-)