[Issue 10438] New: Improve template deduction error message

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jun 21 08:18:12 PDT 2013


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 at puremagic.com
        ReportedBy: jlquinn at optonline.net


--- Comment #0 from Jerry Quinn <jlquinn at 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:
/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: -------


More information about the Digitalmars-d-bugs mailing list