← Back to index
|
Original Bugzilla link
Bug 7489 – A problem map on AA.byKey()
Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2012-02-12T12:19:00Z
Last change time
2013-11-26T22:02:46Z
Assigned to
nobody
Creator
bearophile_hugs
Comments
Comment #0
by bearophile_hugs — 2012-02-12T12:19:39Z
I don't understand what's happening here, sorry. This isn't a fully minimized test case. This program compiles (DMD 2.058beta2), with the first call to foo() commented out: import std.algorithm, std.typecons; void foo(T, U)(T[U] aa) { map!(x => Tuple!U(x))(aa.byKey()); } void main() { int[char] aa1; //foo(aa1); int[int] aa2; foo(aa2); } If I comment out the second call to foo() it compiles still: import std.algorithm, std.typecons; void foo(T, U)(T[U] aa) { map!(x => Tuple!U(x))(aa.byKey()); } void main() { int[char] aa1; foo(aa1); int[int] aa2; //foo(aa2); } But the whole program doesn't compile: import std.algorithm, std.typecons; void foo(T, U)(T[U] aa) { map!(x => Tuple!U(x))(aa.byKey()); } void main() { int[char] aa1; foo(aa1); int[int] aa2; foo(aa2); } DMD 2.058beta2 gives: ...\dmd2\src\phobos\std\typecons.d(379): Error: cannot implicitly convert expression (_param_0) of type int to char test.d(3): Error: template instance std.typecons.Tuple!(char).Tuple.__ctor!(int) error instantiating ...\dmd2\src\phobos\std\algorithm.d(382): instantiated from here: __lambda2!(int) test.d(3): instantiated from here: map!(Result) test.d(9): instantiated from here: foo!(int,int) ...\dmd2\src\phobos\std\algorithm.d(382): Error: template instance test.foo!(int,char).foo.__lambda2!(int) error instantiating test.d(3): instantiated from here: map!(Result) test.d(9): instantiated from here: foo!(int,int)