<div dir="ltr">On Thu, Oct 31, 2013 at 4:25 PM, David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><span style="color:rgb(80,0,80)">On Thu, Oct 31, 2013 at 4:12 PM, Richard Trieu </span><span dir="ltr" style="color:rgb(80,0,80)"><<a href="mailto:rtrieu@google.com" target="_blank">rtrieu@google.com</a>></span><span style="color:rgb(80,0,80)"> wrote:</span><br>

<div class="gmail_extra"><div class="gmail_quote"><div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div>On Thu, Oct 31, 2013 at 2:44 PM, Richard Trieu <span dir="ltr"><<a href="mailto:rtrieu@google.com" target="_blank">rtrieu@google.com</a>></span> wrote:<br>


</div><div class="gmail_extra"><div class="gmail_quote"><div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div>On Thu, Oct 31, 2013 at 10:35 AM, David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>></span> wrote:<br>



</div><div class="gmail_extra"><div class="gmail_quote"><div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">Looks pretty reasonable - but are these two separate code changes, or do they interrelate in some way? If they're separate changes that can have separate test cases, it'd be nice to commit them each in their on commit just for clarity.<br>




</div></blockquote><div><br></div></div><div>Yes, I can separate them into two pieces when I submit them. </div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">


<div dir="ltr">

<br>Have you considered/plan to look at non-type template parameters?<br><br>template<int Num><br>bool greater(unsigned Val) {<div>  return Val >= Num;<br>}<br><br>... greater<0>(42); ...<br><br>I'm not sure if this tickles the same kind of problem or not - but might be worth checking.</div>





</div><div class="gmail_extra"><br></div></blockquote></div><div>I haven't seen this case yet, but I would say it is good to include this test case too.   I think changing the check to an instantiation dependency check would allow it to catch this case as well.</div>



</div></div></div></blockquote><div><br></div></div><div>I spoke too soon.  The information about non-template types doesn't persist up the AST tree so it isn't as easily retrievable as the substituted template types.  For a simple case like your example, it would be simple to check for a substituted expression in the operand.  For a more complicated constant expression, an AST visitor would be needed, or the function that computes the constant value would need to pass this information back.  I'll stick with template types for now.</div>


</div></div></div></blockquote><div><br></div></div><div>Could we just restrict these warnings to only be done on template patterns, not template specializations? (I know Ted's had some concern about doing work on template patterns in the past because he believed that might create too much work analyzing templates that are never instantiated, though)<br>


<br>Then we'd get constants and types where they were available, and not before.</div><div><div> </div></div></div></div></div></blockquote><div>I think that would be possible and a cleaner way of approaching this.  Currently, Clang warns in both template patters and specializations.  That means if you have :</div>

<div><div><br></div><div>template<int Num></div><div>bool greater(unsigned Val) {</div><div>  return Val >= 0;</div><div>}</div><div><br></div><div>... greater<0>(42); ...</div></div><div>... greater<1>(42); ...<br>

</div><div>... greater<2>(42); ...<br></div><div><br></div><div>There would be four warnings on the return line.  Ignoring the three warnings in the specializations and only showing the one from the template pattern would be best on cutting down the noise.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

<div dir="ltr"><div class="gmail_extra">
<div class="gmail_quote"><div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">

<div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="gmail_extra"><br><div class="gmail_quote"><div>

On Wed, Oct 30, 2013 at 8:17 PM, Richard Trieu <span dir="ltr"><<a href="mailto:rtrieu@google.com" target="_blank">rtrieu@google.com</a>></span> wrote:<br>



</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><div dir="ltr">This patch turns off the tautological compare warnings when one of the operands is a template parameter type.  There's not an easy way to correct the code or silence this warning so this way seemed to be the best solution.  Anyone have any thoughts on altering the behavior of this warning?</div>






<br></div>_______________________________________________<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></blockquote></div><br></div>
</blockquote></div></div><br></div></div>
</blockquote></div></div><br></div></div>
</blockquote></div></div><br></div></div>
</blockquote></div><br></div></div>