www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17263] New: Issue diagnostic if mandatory template parameter

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 puremagic.com
          Reporter: acehreli 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

--
Mar 17