www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10438] New: Improve template deduction error message


           Summary: Improve template deduction error message
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: jlquinn optonline.net

--- Comment #0 from Jerry Quinn <jlquinn optonline.net> 2013-06-21 08:18:11 PDT
import std.array;
void main() {
   auto app = appender!char();

/home/jlquinn/dmd2/linux/bin64/dmd junk.d
junk.d(3): Error: template std.array.appender does not match any function
template declaration. Candidates are:
std.array.appender(A : E[], E)(A array = null)
std.array.appender(A : E[]*, E)(A array)
/home/jlquinn/dmd2/linux/bin64/../../src/phobos/std/array.d(2502): Error:
template std.array.appender cannot deduce template function from argument types
junk.d(3): Error: template instance appender!(char) errors instantiating

It took a little puzzling for me to figure out what was wrong (I know an
experienced D dev wouldn't have trouble).  In this case, I'd love to see a
message describing why a template alternative doesn't match.  For example,
something like:

std.array.appender(A : E[], E)(A array = null)
no match because char is not an array slice

This is clearly an enhancement, but info like this would go a long way towards
speeding up the ability to figure out why template heavy code isn't compiling.

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