Should this compile?

tchaloupka via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Aug 25 11:19:39 PDT 2015


import std.stdio;
import std.range : chain;

auto test(string a) {
     return test(a, "b");
}

auto test(string a, string b) {
     return chain(a, b);
}

void main() {
     writeln(test(a));
}

Ends with: Error: forward reference to inferred return type of 
function call 'test'

I know this exact sample is solvable by default parameter but 
there are cases where it is not possible. What to do then?


More information about the Digitalmars-d-learn mailing list