Fix remaining MSVC warnings in Windows CI (C4804, C4244, C4146, C4305)

libeigen/eigen!2374

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
This commit is contained in:
Rasmus Munk Larsen
2026-04-01 17:20:31 -07:00
parent 6a07970d7d
commit 64885cc6a3
7 changed files with 48 additions and 14 deletions

View File

@@ -2097,7 +2097,15 @@ struct expm1_impl<std::complex<RealScalar>> {
template <typename T>
struct rsqrt_impl {
// C4804: unsafe use of type 'bool' in operation. Unavoidable when instantiated with T=bool.
#if EIGEN_COMP_MSVC
#pragma warning(push)
#pragma warning(disable : 4804)
#endif
EIGEN_DEVICE_FUNC static EIGEN_ALWAYS_INLINE T run(const T& x) { return T(1) / numext::sqrt(x); }
#if EIGEN_COMP_MSVC
#pragma warning(pop)
#endif
};
#if defined(EIGEN_GPU_COMPILE_PHASE)

View File

@@ -15,6 +15,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 {
@@ -1260,4 +1267,8 @@ struct generic_product_impl<Lhs, Rhs, HomogeneousShape, PermutationShape, Produc
} // end namespace Eigen
#if EIGEN_COMP_MSVC
#pragma warning(pop)
#endif
#endif // EIGEN_PRODUCT_EVALUATORS_H