From 36ca36d0def87e3cf10fb0b3d75c6be87b3d3698 Mon Sep 17 00:00:00 2001 From: Pavel Guzenfeld Date: Thu, 19 Mar 2026 03:24:09 +0000 Subject: [PATCH] Guard redundant constexpr static member redeclarations for C++17+ libeigen/eigen!2299 Closes #3061 Co-authored-by: Pavel Guzenfeld <67074795+PavelGuzenfeld@users.noreply.github.com> --- Eigen/src/Core/arch/Default/BFloat16.h | 3 +++ Eigen/src/Core/arch/Default/Half.h | 3 +++ 2 files changed, 6 insertions(+) diff --git a/Eigen/src/Core/arch/Default/BFloat16.h b/Eigen/src/Core/arch/Default/BFloat16.h index 8f1f09208..78d2a9592 100644 --- a/Eigen/src/Core/arch/Default/BFloat16.h +++ b/Eigen/src/Core/arch/Default/BFloat16.h @@ -210,6 +210,8 @@ struct numeric_limits_bfloat16_impl { static EIGEN_CONSTEXPR Eigen::bfloat16 denorm_min() { return Eigen::bfloat16_impl::raw_uint16_to_bfloat16(0x0001); } }; +// Redundant out-of-class definitions are required pre-C++17 but deprecated since. +#if EIGEN_COMP_CXXVER < 17 template EIGEN_CONSTEXPR const bool numeric_limits_bfloat16_impl::is_specialized; template @@ -259,6 +261,7 @@ template EIGEN_CONSTEXPR const bool numeric_limits_bfloat16_impl::traps; template EIGEN_CONSTEXPR const bool numeric_limits_bfloat16_impl::tinyness_before; +#endif } // end namespace bfloat16_impl } // end namespace Eigen diff --git a/Eigen/src/Core/arch/Default/Half.h b/Eigen/src/Core/arch/Default/Half.h index 671a9dcc1..56aeb3fa8 100644 --- a/Eigen/src/Core/arch/Default/Half.h +++ b/Eigen/src/Core/arch/Default/Half.h @@ -301,6 +301,8 @@ struct numeric_limits_half_impl { static _EIGEN_MAYBE_CONSTEXPR Eigen::half denorm_min() { return Eigen::half_impl::raw_uint16_to_half(0x0001); } }; +// Redundant out-of-class definitions are required pre-C++17 but deprecated since. +#if EIGEN_COMP_CXXVER < 17 template constexpr const bool numeric_limits_half_impl::is_specialized; template @@ -350,6 +352,7 @@ template constexpr const bool numeric_limits_half_impl::traps; template constexpr const bool numeric_limits_half_impl::tinyness_before; +#endif } // end namespace half_impl } // end namespace Eigen