aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Core/arch/Default/Half.h
diff options
context:
space:
mode:
authorGravatar Antonio Sanchez <cantonios@google.com>2020-11-12 13:12:00 -0800
committerGravatar Antonio Sánchez <cantonios@google.com>2020-11-14 05:50:42 +0000
commitbb69a8db5da21f3c6b289d010eaa64e757387dca (patch)
tree960d5e2b32d1bd0bbe016c897c6b3de941f2b7b3 /Eigen/src/Core/arch/Default/Half.h
parent90f6d9d23e49143a868a03fea552117c3fceec5a (diff)
Explicit casts of S -> std::complex<T>
When calling `internal::cast<S, std::complex<T>>(x)`, clang often generates an implicit conversion warning due to an implicit cast from type `S` to `T`. This currently affects the following tests: - `basicstuff` - `bfloat16_float` - `cxx11_tensor_casts` The implicit cast leads to widening/narrowing float conversions. Widening warnings only seem to be generated by clang (`-Wdouble-promotion`). To eliminate the warning, we explicitly cast the real-component first from `S` to `T`. We also adjust tests to use `internal::cast` instead of `static_cast` when a complex type may be involved.
Diffstat (limited to 'Eigen/src/Core/arch/Default/Half.h')
-rw-r--r--Eigen/src/Core/arch/Default/Half.h14
1 files changed, 0 insertions, 14 deletions
diff --git a/Eigen/src/Core/arch/Default/Half.h b/Eigen/src/Core/arch/Default/Half.h
index 4fdda8af8..bf408149a 100644
--- a/Eigen/src/Core/arch/Default/Half.h
+++ b/Eigen/src/Core/arch/Default/Half.h
@@ -60,20 +60,6 @@ namespace Eigen {
struct half;
-// explicit conversion operators are no available before C++11 so we first cast
-// half to RealScalar rather than to std::complex<RealScalar> directly
-#if !EIGEN_HAS_CXX11
-namespace internal {
-template <typename RealScalar>
-struct cast_impl<half, std::complex<RealScalar> > {
- EIGEN_DEVICE_FUNC static inline std::complex<RealScalar> run(const half &x)
- {
- return static_cast<std::complex<RealScalar> >(static_cast<RealScalar>(x));
- }
-};
-} // namespace internal
-#endif // EIGEN_HAS_CXX11
-
namespace half_impl {
#if !defined(EIGEN_HAS_GPU_FP16)