From 38b91f256be8bf498f0ba9e8dc4fa0abdd7abe70 Mon Sep 17 00:00:00 2001 From: David Tellenbach Date: Wed, 22 Jul 2020 17:56:15 +0200 Subject: [PATCH] Fix cast of blfoat16 to std::complex This fixes https://gitlab.com/libeigen/eigen/-/issues/1951 --- Eigen/src/Core/arch/Default/BFloat16.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Eigen/src/Core/arch/Default/BFloat16.h b/Eigen/src/Core/arch/Default/BFloat16.h index 3ea725d9b..f9c6e76a9 100644 --- a/Eigen/src/Core/arch/Default/BFloat16.h +++ b/Eigen/src/Core/arch/Default/BFloat16.h @@ -34,9 +34,8 @@ namespace Eigen { struct bfloat16; -// explicit conversion operators are no available before C++11 so we first cast -// bfloat16 to RealScalar rather than to std::complex directly -#if !EIGEN_HAS_CXX11 +// Since we allow implicit conversion of bfloat16 to float and double, we +// need to make the cast to complex a bit more explicit namespace internal { template struct cast_impl > { @@ -46,7 +45,6 @@ struct cast_impl > { } }; } // namespace internal -#endif // EIGEN_HAS_CXX11 namespace bfloat16_impl {