https://issues.dlang.org/show_bug.cgi?id=14965

          Issue ID: 14965
           Summary: Forward reference to inferred return type of function
                    call when using auto return type
           Product: D
           Version: D2
          Hardware: x86_64
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: [email protected]
          Reporter: [email protected]

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.

Workaround is discussed here:
http://forum.dlang.org/post/[email protected]

--

Reply via email to