courbet added a comment. Thanks.
================ Comment at: clang-tidy/cppcoreguidelines/NarrowingConversionsCheck.cpp:35 + hasSourceExpression(IsFloatExpr), + unless(hasParent(castExpr()))) + .bind("cast"), ---------------- 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. ================ Comment at: test/clang-tidy/cppcoreguidelines-narrowing-conversions.cpp:81 + +} // namespace floats ---------------- aaron.ballman wrote: > What should happen in cases like the following: > ``` > template <typename T1, typename T2> > void f(T1 one, T2 two) { > one += two; > } > > void g() { > f(1, 2); > f(1, .5); > } > > #define DERP(i, j) (i += j) > > void h() { > int i = 0; > DERP(1, 2); > DERP(i, .5); > } > ``` I added more tests. 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