[Issue 18037] New: template lambda cannot deduce function from argument types

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Dec 6 10:40:16 UTC 2017


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

          Issue ID: 18037
           Summary: template lambda cannot deduce function from argument
                    types
           Product: D
           Version: D2
          Hardware: x86
                OS: Mac OS X
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: ali.akhtarzada at gmail.com

When you declare a template lambda:

immutable lambda(T) = (T n) => n * n;

and call it without an explicit type it errors with with:

lambda cannot deduce function from argument types !()(int)

auto x = lambda!int(2); // works
auto x = lambda(2); // not works

Is this a bug? - tired on dmd v2.077.1

--


More information about the Digitalmars-d-bugs mailing list