[Issue 17263] New: Issue diagnostic if mandatory template parameter is missing

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Mar 17 11:00:13 PDT 2017


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

          Issue ID: 17263
           Summary: Issue diagnostic if mandatory template parameter is
                    missing
           Product: D
           Version: D2
          Hardware: x86_64
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: acehreli at yahoo.com

import std.algorithm : map;

void main() {
    [1, 2].map(i => i);
}

Error: template std.algorithm.iteration.map cannot deduce function from
argument types !()(int[], void), candidates are:
/home/ali/dmd2.073/linux/bin64/../../src/phobos/std/algorithm/iteration.d(456):
       std.algorithm.iteration.map(fun...) if (fun.length >= 1)
Makefile:142: recipe for target 'deneme' failed

The programmer forgot to put ! after map. It would be much better if the error
message said something like

  "Missing mandatory template arguments for
std.algorithm.iteration.map(fun...)"

Ali

--


More information about the Digitalmars-d-bugs mailing list