<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Apr 16, 2018 at 5:11 AM, Roman Lebedev via Phabricator via cfe-commits <span dir="ltr"><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">lebedev.ri added a comment.<br>
<br>
Re false-positives - at least two [post-]reviewers need to agree on the way forward (see previous comments, mail thread), and then i will implement it.<br>
<span class=""><br>
In <a href="https://reviews.llvm.org/D44883#1068576" rel="noreferrer" target="_blank">https://reviews.llvm.org/<wbr>D44883#1068576</a>, @brooksmoses wrote:<br>
<br>
> A further concern about this in the general case from the reviewer of one of my test-cleanup changes: The "var = *&var" idiom is not necessarily equivalent to "var = var" in cases of user-defined types, because operator& may be overloaded.<br>
<br>
<br>
</span>Release notes state:<br>
<br>
  If you are doing such an assignment intentionally, e.g. in a unit test for<br>
<span class="">  a data structure, the warning can be suppressed by adding ``*&`` to the<br>
  right-hand side or casting it to the appropriate reference type.<br>
<br>
</span>So it could also be `var = static_cast<decltype(var) &>(var);`<br></blockquote><div><br></div><div>Most people using clang won't read release notes. Maybe this could print a "to silence this warning, insert *&" fixit note, like many other warnings do.</div><div><br></div><div>I think of the 3 points you mention, "separate flag for this" is probably the way to go.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5"><br>
<br>
Repository:<br>
  rC Clang<br>
<br>
<a href="https://reviews.llvm.org/D44883" rel="noreferrer" target="_blank">https://reviews.llvm.org/<wbr>D44883</a><br>
<br>
<br>
<br>
______________________________<wbr>_________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-commits</a><br>
</div></div></blockquote></div><br></div></div>