YutongZhuu wrote: > I think this change might went too far. We are seeing this check flagging > code like this: > > ``` > error: implicit conversion loses integer precision: 'int' to 'int8_t' (aka > 'signed char') [-Werror,-Wimplicit-int-conversion]: > int8_t shift = ... > ... > shift = -shift; > ~ ^~~~~~ > ``` > > While technically this is an implicit int conversion, as '-' promote value of > 'shift' from `int8_t` to `int` and the expression reassigns it back to > `int8_t`. But the implicit conversion here has no side effects and it is a > common practice. We appreciate the fact that clang now flagging cases like > the one in the summary, but flagging/fixing the cases like the one above > seems to be unnecessary. Would it be possible to provide better fine grained > control over the `-Wsign-compare` so the clang could still flag the the cases > like the one in the summary but ignore the cases where implicit conversion > has no side effects or UB?
I agree, I will look into this :) https://github.com/llvm/llvm-project/pull/126846 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits