Looks like wrong error message

welkam wwwelkam at gmail.com
Sun Jan 28 20:02:48 UTC 2018


Error says that it cant deduce function from argument types but 
in reality it fails to meet function template constraints. In 
this case !is(CommonType!(staticMap!(ElementType, 
staticMap!(Unqual, Ranges))) == void)

In human terms it means that arguments are not the same type. Is 
this require bug report or it works as expected?

Code:
void main() {
     import std.range : chain;
     string s = "string";
     auto arrayOfStrings = ["string"];
     arrayOfStrings.chain(s);
}

error:
Main.d(9): Error: template std.range.chain cannot deduce function 
from argument types !()(string[], string), candidates are:
C:\D\dmd2\windows\bin\..\..\src\phobos\std\range\package.d(894):  
       std.range.chain(Ranges...)(Ranges rs) if (Ranges.length > 0 
&& allSatisfy!(isInputRange, staticMap!(Unqual, Ranges)) && 
!is(CommonType!(staticMap!(ElementType, staticMap!(Unqual, 
Ranges))) == void))



More information about the Digitalmars-d-learn mailing list