[PATCH] D15814: Implicit conversion from float->bool

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 29 15:35:09 PST 2015


rsmith accepted this revision.
This revision is now accepted and ready to land.

================
Comment at: test/SemaCXX/warn-literal-conversion.cpp:49-50
@@ +48,4 @@
+  // values.
+  bool b3 = 0.0f;
+  bool b4 = 0.0;
+}
----------------
What about

  bool b5 = 1.0;
  bool b6 = 2.0;

? Arguably any `float` -> `bool` conversion changes the value (because `true` and `false` are not values of type `float`), so it wouldn't be completely unreasonable to warn even if the literal is `0.0`.


http://reviews.llvm.org/D15814





More information about the cfe-commits mailing list