From e42dceb3a1ec53f7769aa32f9e709a4c24d6ed3f Mon Sep 17 00:00:00 2001 From: "C. Antonio Sanchez" Date: Sat, 22 Feb 2025 08:36:05 -0800 Subject: [PATCH] Fix implicit copy-constructor warning in TensorRef. --- unsupported/Eigen/CXX11/src/Tensor/TensorRef.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorRef.h b/unsupported/Eigen/CXX11/src/Tensor/TensorRef.h index e12923da0..98223fe79 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorRef.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorRef.h @@ -247,6 +247,8 @@ class TensorRef : public internal::TensorRefBase> { EIGEN_STRONG_INLINE TensorRef() : Base() {} + EIGEN_STRONG_INLINE TensorRef(const TensorRef& other) : Base(other) {} + template EIGEN_STRONG_INLINE TensorRef(const Expression& expr) : Base(expr) { EIGEN_STATIC_ASSERT(internal::is_lvalue::value, @@ -254,6 +256,8 @@ class TensorRef : public internal::TensorRefBase> { "TensorRef?)"); } + TensorRef& operator=(const TensorRef& other) { return Base::operator=(other).derived(); } + template EIGEN_STRONG_INLINE TensorRef& operator=(const Expression& expr) { EIGEN_STATIC_ASSERT(internal::is_lvalue::value, @@ -262,8 +266,6 @@ class TensorRef : public internal::TensorRefBase> { return Base::operator=(expr).derived(); } - TensorRef& operator=(const TensorRef& other) { return Base::operator=(other).derived(); } - template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar& coeffRef(Index firstIndex, IndexTypes... otherIndices) { const std::size_t num_indices = (sizeof...(otherIndices) + 1); @@ -306,17 +308,17 @@ class TensorRef : public internal::TensorRefBase EIGEN_STRONG_INLINE TensorRef(const Expression& expr) : Base(expr) {} + TensorRef& operator=(const TensorRef& other) { return Base::operator=(other).derived(); } + template EIGEN_STRONG_INLINE TensorRef& operator=(const Expression& expr) { return Base::operator=(expr).derived(); } - - TensorRef(const TensorRef& other) : Base(other) {} - - TensorRef& operator=(const TensorRef& other) { return Base::operator=(other).derived(); } }; // evaluator for rvalues -- GitLab