aaron.ballman accepted this revision. aaron.ballman added a comment. This revision is now accepted and ready to land.
I think this generally LGTM. You should wait a bit to see if @alexfh has any other concerns. ================ Comment at: clang-tidy/cppcoreguidelines/NarrowingConversionsCheck.cpp:35 + hasSourceExpression(IsFloatExpr), + unless(hasParent(castExpr()))) + .bind("cast"), ---------------- courbet wrote: > 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. Ah, excellent, thank you! 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