www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15734] New: Need this for map

https://issues.dlang.org/show_bug.cgi?id=15734

          Issue ID: 15734
           Summary: Need this for map
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: temtaime gmail.com

import std.algorithm;

class S {
    int foo(int a) { return a; }

    void test() {
        [ 1, 2, 3 ].map!foo;
    }
}

Error: this for foo needs to be type S not type MapResult!(foo, int[])

changing foo to (a => foo(a))
makes it compileable

--
Feb 28 2016