Please do add those other testcases. Please also add some tests which fail when we come to instantiate the operator++, such as:<br><br>template<typename...T> struct A { void operator++(T...); };<div>A<char> a;<br>
</div><div><br></div><div>... and ...</div><div><br></div><div>struct A { template<typename...T> int operator++(T...); };</div><div>int k1 = A().operator++(0, 0);</div><div>int k2 = A().operator++('0');</div>
<div><br></div><div><br></div><div>Also:</div><div><br></div><div><div>-    if (!ParamIsInt)</div><div>+    bool ParamIsDependent = false;</div><div>+    if (LastParam->getType()->isDependentType())</div><div>+      ParamIsDependent = true;</div>
<div>+</div><div>+    if (!ParamIsInt && !ParamIsDependent)</div></div><div><br></div><div>This seems overly verbose. Please tidy this up; something like:</div><div><br></div><div>  QualType ParamType = LastParam->getType();</div>
<div>  if (!ParamType->isSpecificBuiltinType(BuiltinType::Int) && !ParamType->isDependentType())</div><div><br></div><div>... would be better.</div><br><div>On Thu Jan 30 2014 at 10:07:33 AM, rahul <<a href="mailto:1989.rahuljain@gmail.com">1989.rahuljain@gmail.com</a>> wrote:</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div>Hi Arthur,</div><div><br></div><div>Yes it does fix the other two examples as well. I did check them too while working out the fix. </div>
<div><br></div><div>I will add those too once I get a green signal for the fix :)<br><br>Thanks,<div>Rahul</div><div><br></div></div></div><div dir="auto"><div><br>On 30-Jan-2014, at 11:29 pm, "Arthur O'Dwyer" <<a href="mailto:arthur.j.odwyer@gmail.com" target="_blank">arthur.j.odwyer@gmail.com</a>> wrote:<br>
<br></div></div><blockquote type="cite"><div><div dir="auto"><div dir="ltr">Hi Rahul,<div><br></div><div>  Does your patch fix the other two examples given in PR14995? Perhaps they should also be added as regression tests.</div>
<div>(Just from eyeballing the code, I think your patch *does* fix them, including my example where the T is dependent on a class template instead of on a function template; but it might be nice to test explicitly.)</div>

<div><br></div><div>LGTM.</div><div><br></div><div>–Arthur</div><div><br></div></div></div></div></blockquote><div><div><blockquote type="cite"><div><div dir="auto">On Thu, Jan 30, 2014 at 6:55 AM, Rahul Jain <span dir="ltr"><<a href="mailto:rahul1.jain@samsung.com" target="_blank">rahul1.jain@samsung.com</a>></span> wrote:<br>

</div></div></blockquote></div></div><blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div><blockquote type="cite"><div><div dir="auto">
<p> </p>
<p>Hi,</p>
<p>This patch fixes PR14995 - <span><span>Too eagerly rejects operator function templates.</span></span></p>
<p><span><span>Please help review the same.</span></span></p>
<p><span><span></span></span> </p>
<p><span><span>Index: lib/Sema/SemaDeclCXX.cpp<br>===================================================================<br>--- lib/Sema/SemaDeclCXX.cpp (revision 200465)<br>+++ lib/Sema/SemaDeclCXX.cpp (working copy)<br>@@ -10913,7 +10913,11 @@<br>

     if (const BuiltinType *BT = LastParam->getType()->getAs<BuiltinType>())<br>       ParamIsInt = BT->getKind() == BuiltinType::Int;<br> <br>-    if (!ParamIsInt)<br>+    bool ParamIsDependent = false;<br>

+    if (LastParam->getType()->isDependentType())<br>+      ParamIsDependent = true;<br>+<br>+    if (!ParamIsInt && !ParamIsDependent)<br>       return Diag(LastParam->getLocation(),<br>                   diag::err_operator_overload_post_incdec_must_be_int)<br>

         << LastParam->getType() << (Op == OO_MinusMinus);<br>Index: test/SemaCXX/overloaded-operator.cpp<br>===================================================================<br>--- test/SemaCXX/overloaded-operator.cpp (revision 200465)<br>

+++ test/SemaCXX/overloaded-operator.cpp (working copy)<br>@@ -452,3 +452,16 @@<br>     Result = 1; // expected-error {{no viable overloaded '='}} // expected-note {{type 'PointerUnion<int *, float *>' is incomplete}}<br>

   }<br> }<br>+<br>+namespace PR14995 {<br>+<br>+  struct B {};<br>+  template<typename ...T> void operator++(B, T...) {}<br>+<br>+  void f() {<br>+    B b;<br>+    b++;  // ok<br>+    ++b;  // ok<br>+  }<br>+}<br>
+</span></span></p>

<p><span><span></span></span> </p>
<p><span><span></span></span> </p>
<p><span><span>Thanks,</span></span></p>
<p><span><span>Rahul</span></span></p>
<p> </p>
</div></div></blockquote></div></div></div></blockquote><blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div><blockquote type="cite"><div><div dir="auto"><table>
<tbody>
<tr>
<td>
<p><201401302024474_BGFC2LL5.gif></p></td></tr></tbody></table></div></div></blockquote></div></div></div></blockquote><blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div>
<blockquote type="cite"><div><img src="http://ext.samsung.net/mailcheck/SeenTimeChecker?do=d39c7ebe3c5c4be3b749e4adb16ef39adfe1b2c7effbe582e56225dd835e375f5f887f84397989de4b5562a776ba3bf30029dc535ebebcd3326bbdfb2ea96a2fcf878f9a26ce15a0" border="0" width="0" height="0"><br>

_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu" target="_blank">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
<br></div></blockquote></div></div></div></blockquote><blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div><blockquote type="cite"><div><span>_______________________________________________</span><br>
<span>cfe-commits mailing list</span><br><span><a href="mailto:cfe-commits@cs.uiuc.edu" target="_blank">cfe-commits@cs.uiuc.edu</a></span><br><span><a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a></span><br>
</div></blockquote></div></div></div></blockquote></blockquote>