Bug 2800 – Zeal excess in automatic conversion when using foreach and alias this

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Linux
Creation time
2009-04-04T15:12:00Z
Last change time
2015-06-09T01:27:40Z
Assigned to
nobody
Creator
andrei

Comments

Comment #0 by andrei — 2009-04-04T15:12:50Z
struct Tuple(U...) { U field; alias field this; } struct Iter { bool empty(); void next(); ref Tuple!(int, int) head(); } void main() { foreach (a; Iter()) { } } yields: ./test.d(16): Error: cannot implicitly convert expression (tuple(cast(Tuple!(int,int))__r1.head()._field_field_0,cast(Tuple!(int,int))__r1.head()._field_field_1)) of type (int, int) to Tuple!(int,int) ./test.d(16): Error: cannot implicitly convert expression (tuple(cast(Tuple!(int,int))__r1.head()._field_field_0,cast(Tuple!(int,int))__r1.head()._field_field_1)) of type (int, int) to Tuple!(int,int)
Comment #1 by rsinfu — 2010-09-27T21:47:16Z
It was fixed in release 2.028.