www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 16041] New: Forward reference with auto return

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

          Issue ID: 16041
           Summary: Forward reference with auto return
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: maxsamukha gmail.com

The compiler should be able to resolve the return type:

struct Tree {
    Tree* left;
}

auto fmap() {
    return new Tree(fmap());
}

void main()
{
    fmap();
}

Error: forward reference to inferred return type of function call 'fmap()'

--
May 18 2016