rsmith added inline comments.

================
Comment at: include/clang/Basic/DiagnosticSemaKinds.td:3227
@@ -3226,1 +3226,3 @@
+def note_ovl_candidate_ambiguous_base_classes : Note<
+    "candidate template ignored: ambiguous base classes of %0 match %1">;
 
----------------
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):

  "If <deducing against all base classes> yields more than one possible deduced 
A, type deduction fails"

... 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):

  template<int> struct A {};
  struct B : A<0> {};
  struct C : A<1> {};
  struct D : B, C {};
  template<int N> void f(A<N>);
  void f(...);
  void g(D d) { f(d); }  // deduction should succeed, should choose f<0>, 
result is hard error 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.

================
Comment at: include/clang/Sema/Sema.h:6450
@@ -6449,1 +6449,3 @@
+    /// \brief Multiple base classes could have been successfully deduced.
+    TDK_AmbiguousBaseClasses,
     /// \brief Deduction failed; that's all we know.
----------------
`TDK_InconsistentBaseClassDeduction` maybe?

================
Comment at: lib/Sema/SemaOverload.cpp:599-603
@@ -597,7 +598,7 @@
   case Sema::TDK_NonDeducedMismatch: {
     // FIXME: Should allocate from normal heap so that we can free this later.
     DFIArguments *Saved = new (Context) DFIArguments;
     Saved->FirstArg = Info.FirstArg;
     Saved->SecondArg = Info.SecondArg;
     Result.Data = Saved;
     break;
----------------
Please update the comments in include/clang/Sema/TemplateDeduction.h to say 
what `Info.FirstArg` and `Info.SecondArg` mean for `TDK_AmbiguousBaseClasses`.


http://reviews.llvm.org/D22311



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to