carlosgalvezp added a comment.

Hi @vladimir.plyashkun !

I looked at the screenshot in the link you posted. What is the type of `value`?

Consider that if `value` is an `uint8_t`, as per the integer promotion rules, 
it will be promoted to (signed) `int` before running the bitwise operation. 
Therefore `clang-tidy` is right to point out the problem with `value`. Check it 
out:

https://godbolt.org/z/8EMcPd6rd

  `-DeclStmt <line:6:5, col:22>
    `-VarDecl <col:5, col:18> col:10 y 'int':'int' cinit
      `-BinaryOperator <col:14, col:18> 'int' '&'
        |-ImplicitCastExpr <col:14> 'int' <IntegralCast>
        | `-ImplicitCastExpr <col:14> 'std::uint8_t':'unsigned char' 
<LValueToRValue>
        |   `-DeclRefExpr <col:14> 'std::uint8_t':'unsigned char' lvalue Var 
0x55db629e40e8 'x' 'std::uint8_t':'unsigned char'
        `-IntegerLiteral <col:18> 'int' 255


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D131678/new/

https://reviews.llvm.org/D131678

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

Reply via email to