From 8b9dbcdaaf668d39ace2757f5d91860036a8e738 Mon Sep 17 00:00:00 2001 From: Tyler Veness Date: Thu, 7 Aug 2025 00:03:33 +0000 Subject: [PATCH] Fix numext::bit_cast() compilation failure in C++20 --- Eigen/src/Core/NumTraits.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Eigen/src/Core/NumTraits.h b/Eigen/src/Core/NumTraits.h index b93faae26..bf41c3bb6 100644 --- a/Eigen/src/Core/NumTraits.h +++ b/Eigen/src/Core/NumTraits.h @@ -98,7 +98,10 @@ namespace numext { /** \internal bit-wise cast without changing the underlying bit representation. */ #if defined(__cpp_lib_bit_cast) && __cpp_lib_bit_cast >= 201806L -EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC constexpr Tgt bit_cast(const Src& src) { return std::bit_cast(src); } +template +EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC constexpr Tgt bit_cast(const Src& src) { + return std::bit_cast(src); +} #elif EIGEN_HAS_BUILTIN(__builtin_bit_cast) template EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC constexpr Tgt bit_cast(const Src& src) {