www.digitalmars.com         C & C++   DMDScript  

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

http://d.puremagic.com/issues/show_bug.cgi?id=10438

           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



---
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:
/home/jlquinn/dmd2/linux/bin64/../../src/phobos/std/array.d(2502):       
std.array.appender(A : E[], E)(A array = null)
/home/jlquinn/dmd2/linux/bin64/../../src/phobos/std/array.d(2611):       
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
!(char)()
junk.d(3): Error: template instance appender!(char) errors instantiating
template


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:

/home/jlquinn/dmd2/linux/bin64/../../src/phobos/std/array.d(2502):       
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