[Issue 5288] New: auto return: forward ref error when using it with recursive functions

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Nov 29 03:23:22 PST 2010


http://d.puremagic.com/issues/show_bug.cgi?id=5288

           Summary: auto return: forward ref error when using it with
                    recursive functions
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: nfxjfg at gmail.com


--- Comment #0 from nfxjfg at gmail.com 2010-11-29 03:21:53 PST ---
auto x(int z) {
    if (z == 1) {
        return x(z);  //line 3
    } else {
        return z;     //line 5
    }
}

z.d(3): Error: forward reference to x
z.d(5): Error: mismatched function return type inference of int and _error_

It works when you switch line 3 and 5.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list