[PATCH] D53488: [clang-tidy] Improving narrowing conversions

Guillaume Chatelet via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 22 02:58:19 PST 2018


gchatelet marked 2 inline comments as done.
gchatelet added inline comments.


================
Comment at: test/clang-tidy/cppcoreguidelines-narrowing-conversions.cpp:42-44
   i += 2.0;
-  // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: narrowing conversion from 'double' to 'int' [cppcoreguidelines-narrowing-conversions]
+  // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: narrowing conversion from constant 'double' to 'int' [cppcoreguidelines-narrowing-conversions]
   i += 2.0f;
----------------
aaron.ballman wrote:
> I don't think these should diagnose. They're both harmless as the literal values are exactly representable in the destination type.
Yes indeed they are harmless but why not write the correct literal in the first place?
I'm keeping these warnings for now. Let me know if you feel strongly about it.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D53488





More information about the cfe-commits mailing list