[Issue 11721] New: regression: std.utf.toUTFindex throws error instead of exception
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Dec 10 17:03:51 PST 2013
https://d.puremagic.com/issues/show_bug.cgi?id=11721
Summary: regression: std.utf.toUTFindex throws error instead of
exception
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: regression
Priority: P2
Component: Phobos
AssignedTo: nobody at puremagic.com
ReportedBy: timothee.cour2 at gmail.com
--- Comment #0 from Timothee Cour <timothee.cour2 at gmail.com> 2013-12-10 17:03:35 PST ---
(this came up in discussion EMAIL:std.utf: use throw UTFException instead of
assert(0) in stride, etc)
063_2: ok
git head/064_2: fails core.exception.AssertError at phobos/std/utf.d(171): Past
the end of the UTF-8 sequence
import std.traits;
inout(C)[] slice(C)(inout(C)[] str, size_t i, size_t j) if(isSomeChar!C) {
import std.utf;
immutable first = str.toUTFindex(i);
immutable second = str[first .. $].toUTFindex(j-i) + first;
return str[first .. second];
}
unittest{
auto a = "≈açç√ef";
import std.exception;
import core.exception;
assertThrown!Throwable(a.slice(2,8));//ok
assertThrown!RangeError(a.slice(2,8));//fails
}
--
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list