lebedev.ri added a comment.

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.

In https://reviews.llvm.org/D44883#1068576, @brooksmoses wrote:

> 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.


Release notes state:

  If you are doing such an assignment intentionally, e.g. in a unit test for
  a data structure, the warning can be suppressed by adding ``*&`` to the
  right-hand side or casting it to the appropriate reference type.

So it could also be `var = static_cast<decltype(var) &>(var);`


Repository:
  rC Clang

https://reviews.llvm.org/D44883



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to