Bug 5576 – Problem with map() that yields Tuples

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2011-02-14T11:15:00Z
Last change time
2012-10-27T17:35:58Z
Keywords
rejects-valid
Assigned to
nobody
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2011-02-14T11:15:51Z
import std.algorithm, std.typecons; struct Foo1 { int x; } alias Tuple!(int) Foo2; void main() { auto m1 = map!((int x){ return Foo1(x); })([1, 2]); // OK auto m2 = map!((x){ return Foo2(x); })([1, 2]); // OK auto m3 = map!((int x){ return Foo2(x); })([1, 2]); // Error } DMD 2.051 prints this error message that I don't understand: test.d(7): Error: cannot implicitly convert expression (0) of type int to Tuple!(int)
Comment #1 by lovelydear — 2012-04-22T16:14:37Z
Runs fine on 2.059 Win32
Comment #2 by hsteoh — 2012-10-27T10:39:41Z
Works fine on git HEAD, Linux 64-bit.
Comment #3 by bearophile_hugs — 2012-10-27T17:35:58Z
Closed.