Quuxplusone added inline comments.

================
Comment at: lib/Sema/SemaExpr.cpp:12087
+  case BO_AndAssign:
+  case BO_OrAssign:
+    DiagnoseSelfAssignment(S, LHS, RHS, OpLoc, /*IsBuiltin=*/false);
----------------
I understand why `x &= x` and `x |= x` are mathematically special for the 
built-in types, but surely `x -= x` and `x ^= x` and `x /= x` are just as 
likely to indicate programmer error. I would be happy if Clang either took the 
philosophical stance "We will diagnose `x = x` but uniformly //never// `x op= 
x`," or else took the pragmatic stance "We will diagnose any `x op= x` or `x op 
x` that seems likely to be a programming bug." This "middle way" of warning 
only for `&=` and `|=` is bothersome to me.


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