http://d.puremagic.com/issues/show_bug.cgi?id=10078
Summary: std.string.indexOf(Char[], dchar, CaseSensitive) fails at compile time Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: Phobos AssignedTo: nob...@puremagic.com ReportedBy: mich...@overuse.org --- Comment #0 from Mike Houston <mich...@overuse.org> 2013-05-13 16:44:16 PDT --- Created an attachment (id=1213) Patch to indexOf to avoid calling memchr DMD 2.062 OS X If the std.string.indexOf(Char[], dchar, CaseSensitive) method is called at compile time with an ASCII dchar, it will fail: /usr/share/dmd/src/phobos/std/string.d(345): Error: memchr cannot be interpreted at compile time, because it has no available source code Test case: import std.stdio; import std.string; int index = indexOf("xyz", cast(dchar) 'x'); // Fails compile int index1 = indexOf("xyz", cast(dstring) "x"); // Succeeds void main() { writeln("indexOf(\"xyz\", \"x\") = ", index); } Patch: I've modified the string.d implementation to avoid calling memchr. In that branch of the code, I have inserted a modified version of the case-insensitive version of the search loop. Diff file attached against the source included in the 2.0.62 distribution. Regards, Mike. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------