Fix ~1,460 MSVC warnings from generic code instantiated with bool

libeigen/eigen!2364

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
This commit is contained in:
Rasmus Munk Larsen
2026-03-29 21:05:49 -07:00
parent 806c7b6590
commit 801a9ee690
3 changed files with 23 additions and 1 deletions

View File

@@ -72,7 +72,7 @@ struct evaluator<RealView<Xpr>> : private evaluator<Xpr> {
static constexpr int CoeffReadCost = BaseEvaluator::CoeffReadCost;
static constexpr int Alignment = BaseEvaluator::Alignment;
static constexpr bool IsRowMajor = ExpressionTraits::IsRowMajor;
static constexpr bool DirectAccess = Flags & DirectAccessBit;
static constexpr bool DirectAccess = (Flags & DirectAccessBit) != 0;
using ComplexCoeffReturnType = std::conditional_t<DirectAccess, const ComplexScalar&, ComplexScalar>;
using CoeffReturnType = std::conditional_t<DirectAccess, const Scalar&, Scalar>;

View File

@@ -13,6 +13,13 @@
// IWYU pragma: private
#include "../InternalHeaderCheck.h"
// C4804: unsafe use of type 'bool' in operation. Unavoidable in generic code
// instantiated with bool scalars (e.g. += and * on bool).
#if EIGEN_COMP_MSVC
#pragma warning(push)
#pragma warning(disable : 4804)
#endif
namespace Eigen {
namespace internal {
@@ -2396,4 +2403,8 @@ inline void setCpuCacheSizes(std::ptrdiff_t l1, std::ptrdiff_t l2, std::ptrdiff_
} // end namespace Eigen
#if EIGEN_COMP_MSVC
#pragma warning(pop)
#endif
#endif // EIGEN_GENERAL_BLOCK_PANEL_H

View File

@@ -13,6 +13,13 @@
// IWYU pragma: private
#include "../InternalHeaderCheck.h"
// C4804: unsafe use of type 'bool' in operation. Unavoidable in generic code
// instantiated with bool scalars (e.g. += and * on bool).
#if EIGEN_COMP_MSVC
#pragma warning(push)
#pragma warning(disable : 4804)
#endif
namespace Eigen {
namespace internal {
@@ -672,4 +679,8 @@ general_matrix_vector_product<Index, LhsScalar, LhsMapper, RowMajor, ConjugateLh
} // end namespace Eigen
#if EIGEN_COMP_MSVC
#pragma warning(pop)
#endif
#endif // EIGEN_GENERAL_MATRIX_VECTOR_H