[Issue 4139] New: Forward reference error in front() of iterable struct

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat May 1 12:20:54 PDT 2010


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

           Summary: Forward reference error in front() of iterable struct
           Product: D
           Version: unspecified
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2010-05-01 12:20:53 PDT ---
This is D2 code:


Foo!(TArray) foo(TArray)(TArray r) { // the usual helper function
    return Foo!(TArray)(r);
}
struct Foo(TArray) {
    TArray arr;
    bool empty() { return !arr.length; }
    void popFront() { arr = arr[1 .. $]; }
    // int front() { return arr[0]; } // OK
    auto front() { return arr[0]; } // line 12
}
void main() {
    foreach (el; foo([10])) {}
}


DMD 2.043 prints:
test.d(12): Error: forward reference to inferred return type of function call
__r1.front()

-- 
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