Previously, clang would give a terrible diagnostic for the following:
template <int N> struct B {}; struct D : B<0>, B<1> {}; template <int N> int f(B<N>) { return 0; } // error, ambiguous bases of 'D' could be deduced. int main() { f(D()); }
This patch just introduces a new deduction failure kind: TDK_AmbiguousBaseClasses, and uses it to emit a better diagnostic.
Thanks!
ambiguous -> multiple, perhaps? (An "ambiguous base class" is something else.)
However, even that's not quite right. The rule is (from [temp.deduct.call]/5):
... so deduction failure only happens if the base classes deduce different template arguments, not just if multiple deductions succeed. In particular, if you multiply-inherit from the same base class, then deduction can succeed (even though the subsequent initialization of the parameter will fail due to ambiguity):
So maybe we should word this more like the note_ovl_candidate_deduced_mismatch case, since the problem really is that we deduced two different values for the same template parameter.