[Issue 5576] New: Problem with map() that yields Tuples

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Feb 14 11:18:22 PST 2011


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

           Summary: Problem with map() that yields Tuples
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2011-02-14 11:15:51 PST ---
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)

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


More information about the Digitalmars-d-bugs mailing list