gchatelet added inline comments.

================
Comment at: test/clang-tidy/cppcoreguidelines-narrowing-conversions.cpp:79-81
+  // TODO: Provide an automatic fix if the number is exactly representable in 
the destination type.
+  f += 2.0;
+  // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: narrowing conversion from 
constant 'double' to 'float' [cppcoreguidelines-narrowing-conversions]
----------------
aaron.ballman wrote:
> gchatelet wrote:
> > aaron.ballman wrote:
> > > This is not a narrowing conversion -- there should be no diagnostic here. 
> > > See [dcl.init.list]p7.
> > Thx for pointing this out.
> > I would like to keep the diagnostic (without mentioning the narrowing) 
> > because there is no reason to write `2.0` instead of `2.0f`. WDYT?
> I see no reason to warn on a literal value that isn't changed as a result of 
> the notional narrowing. The standard clearly defines the behavior, so I think 
> that would be needlessly chatty.
Done. Plus added som tests.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D53488



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to