<div dir="ltr">Submitted <a href="http://reviews.llvm.org/D17215">http://reviews.llvm.org/D17215</a> </div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Feb 11, 2016 at 4:46 PM, don hinton <span dir="ltr"><<a href="mailto:hintonda@gmail.com" target="_blank">hintonda@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><font face="arial, helvetica, sans-serif">The following code will crash the clang:</font><div><font face="monospace, monospace"><br></font></div><div><div><font face="monospace, monospace"> template<class T></font></div><div><font face="monospace, monospace"> struct X {</font></div><div><font face="monospace, monospace"> void bar(T t) {}</font></div><div><font face="monospace, monospace"> void foo(T t, int i) {}</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace"> template<class U></font></div><div><font face="monospace, monospace"> void foo(T t, U i) {}</font></div><div><font face="monospace, monospace"> };</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace"> template class X<double>;</font></div><div><font face="monospace, monospace"> template void X<double>::bar(double t); // error, reports duplicate </font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace"> template void X<double>::foo(double t, int i); // crashes, but should report duplicate<br></font></div></div><div><font face="monospace, monospace"><br></font></div><div><div><font face="monospace, monospace"> template void X<double>::foo<int>(double t, int i); // crashes, but should be okay</font></div></div><div><br></div><div><br></div><div>The error for bar() is correct, since it was already explicitly instantiated by X, however, I believe the first, non-templatized, version of foo() should have the same behavior, but it crashes, as does the templatized version.</div><div><br></div><div>But if I just use them without explicit instantiation, they work as expected, e.g.:</div><div><br></div><div><font face="monospace, monospace"> X<double> x;</font></div><div><font face="monospace, monospace"> x.bar(1.2);</font></div><div><font face="monospace, monospace"> x.foo(1.2, 1);</font></div><div><font face="monospace, monospace"> x.foo<int>(1.2, 1); </font></div><div><br></div><div>With the non-templatized version of foo() taking precidence. </div><div><br></div><div>Before I make a run at fixing this, I just wanted to make sure I was doing the right thing.</div><div><br></div><div>thanks...</div><span class="HOEnZb"><font color="#888888"><div>don</div><div><br></div><div><br></div><div><br></div></font></span></div>
</blockquote></div><br></div>