[PATCH] D44883: [Sema] Extend -Wself-assign and -Wself-assign-field to warn on overloaded self-assignment (classes)

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 27 11:05:20 PDT 2018


rjmccall added inline comments.


================
Comment at: lib/Sema/SemaExpr.cpp:12093
+    break;
+  }
+
----------------
I think doing this here can result in double-warning if the overload resolves to a builtin operator.  Now, it might not actually be possible for that to combine with the requirements for self-assignment, but still, I think the right place to diagnose this for C++ is the same place we call DiagnoseSelfMove in CreateOverloadedBinOp.

Can CheckIdentityFieldAssignment just be integrated with DiagnoseSelfAssignment so that callers don't need to do call both?


Repository:
  rC Clang

https://reviews.llvm.org/D44883





More information about the cfe-commits mailing list