digitalmars.D.bugs - [Issue 14845] New: [REG 2.068] some rangified Char[] functions no
- via Digitalmars-d-bugs (52/52) Jul 28 2015 https://issues.dlang.org/show_bug.cgi?id=14845
https://issues.dlang.org/show_bug.cgi?id=14845 Issue ID: 14845 Summary: [REG 2.068] some rangified Char[] functions no longer take a static array Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: regression Priority: P1 Component: phobos Assignee: nobody puremagic.com Reporter: code dawg.eu cat > bug.d << CODE import std.string; auto test(char[25] buf) { return indexOf(buf, '\n', 10); } CODE dmd -c bug ---- bug.d(5): Error: template std.string.indexOf cannot deduce function from argument types !()(char[25], char, int), candidates are: /usr/include/dmd/phobos/std/string.d(346): std.string.indexOf(Range)(Range s, in dchar c, in CaseSensitive cs = CaseSensitive.yes) if (isInputRange!Range && isSomeChar!(ElementEncodingType!Range)) /usr/include/dmd/phobos/std/string.d(471): std.string.indexOf(T, ulong n)(ref T[n] s, in dchar c, in CaseSensitive cs = CaseSensitive.yes) if (isSomeChar!T) /usr/include/dmd/phobos/std/string.d(545): std.string.indexOf(Range)(Range s, in dchar c, in size_t startIdx, in CaseSensitive cs = CaseSensitive.yes) if (isInputRange!Range && isSomeChar!(ElementEncodingType!Range)) /usr/include/dmd/phobos/std/string.d(641): std.string.indexOf(Range, Char)(Range s, const(Char)[] sub, in CaseSensitive cs = CaseSensitive.yes) if (isForwardRange!Range && isSomeChar!(ElementEncodingType!Range) && isSomeChar!Char) /usr/include/dmd/phobos/std/string.d(794): std.string.indexOf(Char1, Char2)(const(Char1)[] s, const(Char2)[] sub, in size_t startIdx, in CaseSensitive cs = CaseSensitive.yes) if (isSomeChar!Char1 && isSomeChar!Char2) ---- The old (Char)(Char[]) signatures would trigger an implicit conversion of static to dynamic arrays, the new (Range)(Range r) signatures don't. A single overload of indexOf was fixed, but we need to go through all functions that have been rangified since 2.067.0 and check for this bug. https://github.com/D-Programming-Language/phobos/pull/3191 The only fully compatible overload is (T, size_t n)(ref T[n] s), which should forward to the rangified function. --
Jul 28 2015