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



--- Comment #9 from yebblies <yebbl...@gmail.com> 2012-02-01 23:55:06 EST ---
(In reply to comment #8)
> (In reply to comment #7)
> > more specialized == better match.  That is how template type deduction 
> > works.
> 
> But there's no (T : int) version of this template.
> 

It doesn't matter.

The compiler does template argument deduction through a function called
matchArg in template.c.  It will generate one of the match levels
(MATCHnomatch, MATCHconvert, MATCHconst, MATCHexact) based on what the template
parameter, spectype, and argument are.  matchArg does not know or care what the
other overloads of the template are, or even what the other arguments are.

For (T : int) to be preferred over (T), it must return a worse match level for
the unspecialized parameter.  Currently it will return MATCHconvert for these
parameters, and return MATCHexact only when there is a (matching) spec type.

Which leaves you with a non-exact match for (T) and (T...), even if it's the
only overload.

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

Reply via email to