Cannot deduce function from argument type when single candidate

Preetpal preetpal.sohal at gmail.com
Mon Mar 29 01:24:13 UTC 2021


This is a minimal example that re-creates the error message. I am 
not understanding the error message that the compiler is giving 
me. From my understanding, the compiler is saying that there is a 
single possible candidate but it cannot figure out which one to 
choose. Why would it not choose the only possible candidate?

Minimal example:

void main() {
     import std.range;
     import std.stdio;

     char[] arr = ['a', 'b', 'c'];

     writeln(isRandomAccessRange(arr));
}

Error message:

mini_example.d(8): Error: template 
std.range.primitives.isRandomAccessRange cannot deduce function 
from argument types !()(char[]), candidates are:
b:\D\DMD\D\dmd2\windows\bin\..\..\src\phobos\std\range\primitives.d(1085):        isRandomAccessRange(R)


More information about the Digitalmars-d-learn mailing list