[PATCH] D58145: [Sema] Fix a bogus -Wconversion warning

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 13 19:35:14 PST 2019


rjmccall added a comment.

Basically LGTM, especially if we need an emergency fix, but please consider addressing my comment before committing since I'd expect it to be straightforward to solve.



================
Comment at: clang/lib/Sema/SemaChecking.cpp:10634
+  // warning.
+  else if (ResultBT->isFloatingPoint() && ResultBT->getKind() < RBT->getKind() &&
+           // We don't want to warn for system macro.
----------------
Yeah, can we just make a predicate function for this rank comparison?  And really it shouldn't be based on rank: while a difference in FP rank *often* corresponds to a difference in representable range, there are exceptions (notably with `long double` on non-x86 targets (as well as Win64) which is often equivalent to either `double` or `__float128`), and we should probably treat those like we do the integer types, i.e. ignore them.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58145/new/

https://reviews.llvm.org/D58145





More information about the cfe-commits mailing list