--- Comment #11 from yebblies <yebbl...@gmail.com> 2012-02-02 00:42:20 EST ---
(In reply to comment #10)
> So MATCHexact means "the pattern can be matched only by this exact set of
> arguments", and MATCHconvert means "this is one of various sets of arguments
> that can match this pattern".
No, MATCHconvert means 'match with implicit conversions'. These are the same
match levels used for normal function argument matching.
> But then, surely, it would be rejecting the instantiation as ambiguous, not
> picking the (A...) overload.
Actually, (A...) is an alias parameter so it comes up as MATCHexact. (There is
a bug report about this somewhere). Otherwise you would get an ambiguity
error. This is not what should be happening, non-variadic templates should be
preferred over variadic ones.
> Really, it's a fundamental flaw in the compiler logic whereby it conflates two
> essentially orthogonal concepts: exactness and specialisation.
> A correct template instantiation algorithm would:
> - see which template patterns match the instantiation exactly
> - if none, see which template patterns match with implicit conversions
> - of all the matches, determine which is most specialised
It's not that simple when you take multiple parameters, overloads, mixing
explicit template parameters and deduced ones, etc
The ordering (exact match, const match, convert match, deduced match, variadic
match, alias match, specialized match, etc) is complicated and the match system
needs a redesign to cope with it. Expanding the current match system will not
necessarily solve the problem, as the different levels interact in weird ways.
This is probably what will end up happening if a better solution is not found.
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------