www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4139] New: Forward reference error in front() of iterable struct

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: bearophile_hugs eml.cc


--- Comment #0 from bearophile_hugs 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: -------
May 01 2010
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4139


bearophile_hugs eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


--- Comment #1 from bearophile_hugs eml.cc 2010-08-26 07:58:48 PDT ---
This bug is missing in dmd 2.048, so I close it.

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