TITLE: type deduction in template arguments (Newsgroups: comp.lang.c++.moderated, 27 Apr 99) VANDEVOORDE: David Vandevoorde >> Most standard conversions aren't considered during the deduction >> process either, but a few are: in particular, derived-to-base >> conversions and the corresponding contravariant conversions on >> pointer-to-members apply. BONNARD: Valentin Bonnard >Hum... AFAIK, that doesn't make the following valid: > > template > void foo (T, T); > > struct B {}; > struct D : B {}; > > foo (B(), D()); // ill-formed, contradicting deduction > foo (B(), D()); // ok, standard conversion (derived-to-base) > >only the following > > template > struct Y {}; > > template > void bar (Y, Y); > > struct Z : Y {}; > > bar (Z(), Y()); // ok, Y is a template-id > bar (Z(), Z()); // ok, same reason > >[ BTW, egcs agrees with my interpretation. ] > VANDEVOORDE: Exactly: even though deduction can see derived-to-base conversions in some cases, it still looks for a best match on a argument-by-argument basis (and the "no disagreement" rule remains in effect after that).