<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Jun 2, 2014 at 10:08 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:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">I think "pointer to reference not equal to null pointer can only be<br>

false in…" would be better expressed as "address of reference can be<br>
null only in…"<br>
and ditto, "this pointer equal to null pointer can only be true in…"<br>
would be better expressed as "this pointer can be null only in…"<br>
<br>
(C++ doesn't have "pointers to references.")<br>
<br>
I'm also mildly opposed to the name "-Wundefined-bool-conversion",<br>
given that the conversions in question are NOT undefined — in fact,<br>
the reason for the diagnostic is basically that they're TOO defined!<br>
However, I have no better name to offer as a replacement.<br>
<br>
Also, is this case covered by your new diagnostic, or by some old<br>
diagnostic, or is it still un-covered?<br>
<br>
class test3 {<br>
  void bar() {<br>
    if (&y) { } // expected-warning of some sort: address of this->y<br>
cannot be null<br>
    if (!&y) { }  // expected-warning of some sort: address of this->y<br>
cannot be null<br>
  }<br>
  int y;<br>
};<br>
<br></blockquote><div>This is caught by -Wpointer-bool-conversion, which I believe is on by default.</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">

my $.02,<br>
–Arthur<br>
<div><div class="h5"><br>
<br>
On Mon, Jun 2, 2014 at 9:25 PM, Richard Trieu <<a href="mailto:rtrieu@google.com">rtrieu@google.com</a>> wrote:<br>
> Extend tautological compare and bool conversion warnings to undefined pointer operations.  These are cases where all defined behavior will give the expression one value, while the other value can only result from undefined behavior, which the optimizer can remove.  These cases are addresses of references and the this pointer.  This warning was requested in PR19899 in response to commit r209723.<br>

><br>
> <a href="http://reviews.llvm.org/D3999" target="_blank">http://reviews.llvm.org/D3999</a><br>
><br>
> Files:<br>
>   include/clang/Basic/DiagnosticGroups.td<br>
>   include/clang/Basic/DiagnosticSemaKinds.td<br>
>   lib/Sema/SemaChecking.cpp<br>
>   test/SemaCXX/warn-tautological-undefined-compare.cpp<br>
>   test/SemaCXX/warn-undefined-bool-conversion.cpp<br>
><br>
</div></div>> _______________________________________________<br>
> cfe-commits mailing list<br>
> <a href="mailto:cfe-commits@cs.uiuc.edu">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></div>