<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Jun 23, 2016 at 10:37 AM, Erik Pilkington via cfe-commits <span dir="ltr"><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">erik.pilkington created this revision.<br>
erik.pilkington added reviewers: rsmith, faisalv.<br>
erik.pilkington added a subscriber: cfe-commits.<br>
<br>
Previously, Clang would incorrectly accept the following:<br>
```<br>
template<int N> struct A {};<br>
struct B : A<0>, A<1> {};<br>
template<int N> int f(A<N>);<br>
int main() { f(B()); }<br>
```<br>
The problem is that when considering the base classes of B, there are 2 possible ambiguous bases that could be deduced. Therefore, deduction ought to fail (temp.deduct.call p5).<br>
<br>
There are 3 improvements that I want to make here as well:<br>
 1. Introduce a TDK_AmbiguousBaseClasses so that this diagnostic isn't terrible.<br>
 2. Reapply Richard's r267453, (with some modifications) which previously broke stdlibc++'s tuple implementation (PR27601, reverted in r270016). This refactors the handmade base class traversal I fixed here to instead use CXXRecordDecl::forallBases(), I believe that requiring matching number of arguments in the DeduceTemplateArguments at SemaTemplateDeduction.cpp:433 will fix it.<br>
 3. A NFC patch to rename the 10 (!) overloads of DeduceTemplateArguments to have more descriptive names. These functions are *really* annoying to deal with because of that.<br></blockquote><div><br></div><div>I would love to see these as follow-up changes :)</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
If it would be better to do a subset (or all) of these improvements here, I could always update the diff. Fixes PR28195.<br>
<br>
Thanks!<br>
<br>
<a href="http://reviews.llvm.org/D21653" rel="noreferrer" target="_blank">http://reviews.llvm.org/D21653</a><br>
<br>
Files:<br>
  lib/Sema/SemaTemplateDeduction.cpp<br>
  test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p3.cpp<br>
<br>
<br>_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br>
<br></blockquote></div><br></div></div>