[PATCH] D42728: Add more warnings for implict conversions (e.g. double truncation to float).

John McCall via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 2 14:25:03 PST 2018


rjmccall added inline comments.


================
Comment at: lib/Sema/SemaChecking.cpp:9196
+/// floating-point precision.
+static void AnalyzeCompoundAssignment(Sema &S, BinaryOperator *E) {
+  assert(isa<CompoundAssignOperator>(E) &&
----------------
Looking at the other Analyze functions, it looks like you're supposed to recurse on the LHS and RHS in here: this is supposed to diagnose the entire expression tree, not just conversions in the outermost expression.  The test case would be to have an unfortunate implicit conversion embedded somewhere in the LHS or RHS, like as an argument to a call that produces a subscript index or something.


https://reviews.llvm.org/D42728





More information about the llvm-commits mailing list