http://d.puremagic.com/issues/show_bug.cgi?id=7871
Summary: RangeViolation with findSplitBefore Product: D Version: unspecified Platform: All OS/Version: All Status: NEW Severity: regression Priority: P2 Component: DMD AssignedTo: nob...@puremagic.com ReportedBy: jmdavisp...@gmx.com --- Comment #0 from Jonathan M Davis <jmdavisp...@gmx.com> 2012-04-09 01:27:33 PDT --- This code works with 2.058 import std.algorithm; void main() { enum lineStart = `<bookmark href="https://`; string line = `<bookmark href="https://stuff">`; auto a = findSplitBefore(line[lineStart.length .. $], `"`)[0]; } But with the latest head, it gives core.exception.RangeError@q(7): Range violation ---------------- ./q(_d_array_bounds+0x2a) [0x43aae6] ./q() [0x4389be] ./q(_Dmain+0x39) [0x4319c9] ./q(extern (C) int rt.dmain2.main(int, char**).void runMain()+0x17) [0x43b2ab] ./q(extern (C) int rt.dmain2.main(int, char**).void tryExec(scope void delegate())+0x23) [0x43ac2b] ./q(extern (C) int rt.dmain2.main(int, char**).void runAll()+0x3d) [0x43b2f9] ./q(extern (C) int rt.dmain2.main(int, char**).void tryExec(scope void delegate())+0x23) [0x43ac2b] ./q(main+0xd3) [0x43abc3] /lib/libc.so.6(__libc_start_main+0xf5) [0x7f907bdb9455] I'm not sure what's causing the range violation though, since it goes away in weird ways. If you remove the [0], it works, but if I add this line after it auto b = a[0]; it works too. If I don't slice line anymore, it also works. If I slice line like line[0 .. $] or line[$ .. $], it also works, but anything which slices only part of the string (instead of none of it or all of it) results in it failing. So, I have absolutely no clue what's going on here, but clearly something is wrong with the code being generated. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------