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>
This commit is contained in:
Pavel Guzenfeld
2026-03-19 03:24:09 +00:00
committed by Rasmus Munk Larsen
parent 62e23f79dd
commit 36ca36d0de
2 changed files with 6 additions and 0 deletions

View File

@@ -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 <typename T>
EIGEN_CONSTEXPR const bool numeric_limits_bfloat16_impl<T>::is_specialized;
template <typename T>
@@ -259,6 +261,7 @@ template <typename T>
EIGEN_CONSTEXPR const bool numeric_limits_bfloat16_impl<T>::traps;
template <typename T>
EIGEN_CONSTEXPR const bool numeric_limits_bfloat16_impl<T>::tinyness_before;
#endif
} // end namespace bfloat16_impl
} // end namespace Eigen

View File

@@ -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 <typename T>
constexpr const bool numeric_limits_half_impl<T>::is_specialized;
template <typename T>
@@ -350,6 +352,7 @@ template <typename T>
constexpr const bool numeric_limits_half_impl<T>::traps;
template <typename T>
constexpr const bool numeric_limits_half_impl<T>::tinyness_before;
#endif
} // end namespace half_impl
} // end namespace Eigen