[Issue 1650] Incorrect overload selected with IFTI
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Jun 14 22:55:34 PDT 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1650
------- Comment #8 from bugzilla at digitalmars.com 2008-06-15 00:55 -------
> So are you saying that the wrong function is selected because D doesn't have
ADL?
No, this has nothing whatsoever to do with ADL. Template functions are
overloaded based on the template parameters, not the function parameters.
>And can you explain why the first template is more specialized than the
other?
Specialization heirarchy is determined the same way as in C++. Template A is
"at least as specialized" as template B if the template parameters of A can be
used to call B. In the examples, (T) can call (T,U=void), so it is at least as
specialized. But (T,void) cannot call (T), so it is equally or less
specialized. Therefore (T) is more specialized.
(I know this is a bit of a bear to slog through.)
--
More information about the Digitalmars-d-bugs
mailing list