www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Possible bug

reply Jack Applegame <japplegame gmail.com> writes:
ttt.d
 import std.string;
 
 void main() {
     lastIndexOf("aa","bb");
 }
rdmd ttt.d compiles successfully without any errors or warnings rdmd -dw ttt.d compiles successfully without any errors or warnings rdmd -de ttt.d
 /usr/include/dmd/phobos/std/string.d(1239): Error: template 
 std.algorithm.searching.endsWith cannot deduce function from 
 argument types !((a, b) => std.uni.toLower(a) == 
 std.uni.toLower(b))(const(char)[], const(char)[]), candidates 
 are:
/usr/include/dmd/phobos/std/algorithm/searching.d(981): 
std.algorithm.searching.endsWith(alias pred = "a == b", Range, 
Needles...)(Range doesThisEnd, Needles withOneOfThese) if 
(isBidirectionalRange!Range && Needles.length > 1 && 
is(typeof(.endsWith!pred(doesThisEnd, withOneOfThese[0])) : 
bool) && is(typeof(.endsWith!pred(doesThisEnd, 
withOneOfThese[1..__dollar])) : uint))
 /usr/include/dmd/phobos/std/algorithm/searching.d(1048): 
 std.algorithm.searching.endsWith(alias pred = "a == b", R1, 
 R2)(R1 doesThisEnd, R2 withThis) if (isBidirectionalRange!R1 && 
 isBidirectionalRange!R2 && 
 is(typeof(binaryFun!pred(doesThisEnd.back, withThis.back)) : 
 bool))
 /usr/include/dmd/phobos/std/algorithm/searching.d(1076): 
 std.algorithm.searching.endsWith(alias pred = "a == b", R, E)(R 
 doesThisEnd, E withThis) if (isBidirectionalRange!R && 
 is(typeof(binaryFun!pred(doesThisEnd.back, withThis)) : bool))
 /usr/include/dmd/phobos/std/algorithm/searching.d(1086): 
 std.algorithm.searching.endsWith(alias pred, R)(R doesThisEnd) 
 if (isInputRange!R && ifTestable!(typeof(doesThisEnd.front), 
 unaryFun!pred))
 ttt.d(4): Error: template instance 
 std.string.lastIndexOf!(char, char) error instantiating
Jul 05 2016
parent reply ag0aep6g <anonymous example.com> writes:
On 07/05/2016 12:47 PM, Jack Applegame wrote:
 ttt.d
 import std.string;

 void main() {
     lastIndexOf("aa","bb");
 }
rdmd ttt.d compiles successfully without any errors or warnings rdmd -dw ttt.d compiles successfully without any errors or warnings rdmd -de ttt.d
 /usr/include/dmd/phobos/std/string.d(1239): Error: template
 std.algorithm.searching.endsWith cannot deduce function from argument
 types !((a, b) => std.uni.toLower(a) ==
 std.uni.toLower(b))(const(char)[], const(char)[]), candidates are:
[...] There sure is at least one bug. I guess this has to do with recent changes to symbol lookup/visibility rules. On the line from the error message there are fully qualified references to std.uni.toLower, but std.uni isn't imported as a module. This can easily be fixed in phobos. I've filed an issue: https://issues.dlang.org/show_bug.cgi?id=16238 Something is also going wrong in dmd. There should be a deprecation message.
Jul 05 2016
parent Jack Applegame <japplegame gmail.com> writes:
On Tuesday, 5 July 2016 at 13:48:50 UTC, ag0aep6g wrote:
 Something is also going wrong in dmd. There should be a 
 deprecation message.
Exactly.
Jul 05 2016