Bug 4139 – Forward reference error in front() of iterable struct

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2010-05-01T12:20:00Z
Last change time
2015-06-09T05:15:07Z
Assigned to
nobody
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2010-05-01T12:20:53Z
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()
Comment #1 by bearophile_hugs — 2010-08-26T07:58:48Z
This bug is missing in dmd 2.048, so I close it.