courbet added inline comments.
================ Comment at: clang-tidy/cppcoreguidelines/NarrowingConversionsCheck.cpp:35 + hasSourceExpression(IsFloatExpr), + unless(hasParent(castExpr()))) + .bind("cast"), ---------------- aaron.ballman wrote: > courbet wrote: > > aaron.ballman wrote: > > > I believe this code will not diagnose under this check -- is that > > > intended as a way to silence the check? > > > ``` > > > i += (double)0.5; > > > ``` > > Did you mean `(int)0.5` ? > > > > Yes, the user essentially told us they knew what they were doing. I've > > added an explicit test for this. > I truly meant `(double)0.5` -- where the cast has no impact on the narrowing > conversion, but the check still doesn't diagnose because there's an explicit > cast present. Should the check be checking for explicit casts to the narrowed > type? OK, then that's fine (I added a test for that for): there is an explicit cast to double, but then the compiler generates an extra cast to int on top, which triggers. Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D38455 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits