D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 4345 - std.range.take!string: "Nonsensical finite range with slicing but no length"
Summary: std.range.take!string: "Nonsensical finite range with slicing but no length"
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: Other Mac OS X
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-19 05:39 UTC by Michel Fortin
Modified: 2010-08-16 16:52 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Michel Fortin 2010-06-19 05:39:44 UTC
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 David Simcha 2010-08-16 16:51:03 UTC
Fixed SVN.
Comment 2 bearophile_hugs 2010-08-16 16:52:08 UTC
David, are you trying to fix all Phobos by yourself? Leave some work to the others, please ;-)