Skip to content

clang's new -Wbitwise-instead-of-logical fires on libeigen

clang's new -Wbitwise-instead-of-logical fires on libeigen

Environment

  • Operating System : any (win/mac/linux)
  • Architecture : x64
  • Eigen Version : trunk
  • Compiler Version : clang 14 prerelease
  • Compile Flags : -Wall

Steps to reproduce

Just build with a very recent clang.

What is the current bug behavior?

Warnings are emitted.

What is the expected correct behavior?

No warning.

Warning Messages

../../third_party/eigen3/src\unsupported/Eigen/CXX11/src/Tensor/TensorUInt128.h(81,10): error: use of bitwise '&' with boolean operands [-Werror,-Wbitwise-instead-of-logical]
../../third_party/eigen3/src\unsupported/Eigen/CXX11/src/Tensor/TensorUInt128.h(81,10): error: use of bitwise '&' with boolean operands [-Werror,-Wbitwise-instead-of-logical]
  return (lhs.high == rhs.high) & (lhs.low == rhs.low);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                &&
../../third_party/eigen3/src\unsupported/Eigen/CXX11/src/Tensor/TensorUInt128.h(88,10): error: use of bitwise '|' with boolean operands [-Werror,-Wbitwise-instead-of-logical]
  return (lhs.high != rhs.high) | (lhs.low != rhs.low);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                ||

Anything else that might help

  • Have a plan to fix this issue. thakis/eigen@f5901397 fixes this, but apparently merge requests are currently disabled.