[PATCH] D22311: [Sema] Improve template argument deduction diagnostic for ambiguous base classes

Erik Pilkington via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 13 11:48:37 PDT 2016


erik.pilkington created this revision.
erik.pilkington added reviewers: rsmith, faisalv.
erik.pilkington added a subscriber: cfe-commits.

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!

http://reviews.llvm.org/D22311

Files:
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Sema/Sema.h
  lib/Sema/SemaOverload.cpp
  lib/Sema/SemaTemplateDeduction.cpp
  test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p3.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22311.63836.patch
Type: text/x-patch
Size: 4977 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160713/078d84e0/attachment.bin>


More information about the cfe-commits mailing list