<div dir="ltr">Added test case in r193890.</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Nov 1, 2013 at 3:00 PM, David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@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">Cool - perhaps add a test case for the non-type template parameter case as well? Though it's not really necessary. Up to you.</div>
<div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Nov 1, 2013 at 2:54 PM, Richard Trieu <span dir="ltr"><<a href="mailto:rtrieu@google.com" target="_blank">rtrieu@google.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">Committed in r<span style="font-size:13px;font-family:arial,sans,sans-serif;text-align:right">193887 and r</span><span style="font-size:13px;font-family:arial,sans,sans-serif;text-align:right">193888</span></div>

<div><div>
<div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Nov 1, 2013 at 1:02 PM, David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@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"><br><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div>On Fri, Nov 1, 2013 at 12:15 PM, Arthur O'Dwyer <span dir="ltr"><<a href="mailto:arthur.j.odwyer@gmail.com" target="_blank">arthur.j.odwyer@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>On Thu, Oct 31, 2013 at 5:52 PM, Richard Trieu <<a href="mailto:rtrieu@google.com" target="_blank">rtrieu@google.com</a>> wrote:<br>




> On Thu, Oct 31, 2013 at 4:25 PM, David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>> wrote:<br>
>><br>
</div><div>>> Could we just restrict these warnings to only be done on template<br>
>> patterns, not template specializations? (I know Ted's had some concern about<br>
>> doing work on template patterns in the past because he believed that might<br>
>> create too much work analyzing templates that are never instantiated,<br>
>> though)<br>
><br>
</div><div>> I think that would be possible and a cleaner way of approaching this.<br>
> Currently, Clang warns in both template patters and specializations.  That<br>
> means if you have :<br>
><br>
> template<int Num><br>
> bool greater(unsigned Val) {<br>
>   return Val >= 0;<br>
> }<br>
><br>
> ... greater<0>(42); ...<br>
> ... greater<1>(42); ...<br>
> ... greater<2>(42); ...<br>
><br>
> There would be four warnings on the return line.  Ignoring the three<br>
> warnings in the specializations and only showing the one from the template<br>
> pattern would be best on cutting down the noise.<br>
<br>
</div>Only for -Wtautological-compare, though, right?<br>
<br>
I imagine that there are plenty of warnings that would be useful to<br>
produce during template instantiation, but impossible to detect by<br>
just looking at the pattern (without checking dependent<br>
types/expressions). A trivial example would be<br>
-Wuninitialized for this code:<br>
<br>
    template<typename T> T newval() { T t; return t; }<br>
<br>
Here, newval<int>() has undefined behavior, but newval<std::string>()<br>
is perfectly correct.<br>
<br>
So whereas -Wtautological-compare empirically gives almost 100% false<br>
positives on dependent expressions, -Wuninitialized probably gives<br>
100% *true* positives.</blockquote><div><br></div></div></div><div>Certainly. There are many warnings in each of these buckets, but generally a given warning falls into only one - either it should be done on instantiations or patterns. (there are some similar issues with macros and other things (sizeof/decltype of implementation-provided types, etc)) </div>



</div></div></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>