http://d.puremagic.com/issues/show_bug.cgi?id=7489

           Summary: A problem map on AA.byKey()
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: bearophile_h...@eml.cc


--- Comment #0 from bearophile_h...@eml.cc 2012-02-12 12:19:39 PST ---
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)

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

Reply via email to