diff --git a/Eigen/src/Core/Transpose.h b/Eigen/src/Core/Transpose.h index 6928ae31a..b1a509a3e 100644 --- a/Eigen/src/Core/Transpose.h +++ b/Eigen/src/Core/Transpose.h @@ -310,8 +310,23 @@ struct ei_blas_traits > static inline const XprType extract(const XprType& x) { return x; } }; +template +struct ei_check_transpose_aliasing_compile_time_selector +{ + enum { ret = ei_blas_traits::IsTransposed != DestIsTranposed + }; +}; + +template +struct ei_check_transpose_aliasing_compile_time_selector > +{ + enum { ret = ei_blas_traits::IsTransposed != DestIsTranposed + || ei_blas_traits::IsTransposed != DestIsTranposed + }; +}; + template -struct ei_check_transpose_aliasing_selector +struct ei_check_transpose_aliasing_run_time_selector { static bool run(const Scalar* dest, const OtherDerived& src) { @@ -320,7 +335,7 @@ struct ei_check_transpose_aliasing_selector }; template -struct ei_check_transpose_aliasing_selector > +struct ei_check_transpose_aliasing_run_time_selector > { static bool run(const Scalar* dest, const CwiseBinaryOp& src) { @@ -329,12 +344,44 @@ struct ei_check_transpose_aliasing_selector::IsTransposed,OtherDerived>::ret + > +struct checkTransposeAliasing_impl +{ + static void run(const Derived& dst, const OtherDerived& other) + { + ei_assert((!ei_check_transpose_aliasing_run_time_selector + ::IsTransposed,OtherDerived> + ::run(ei_extract_data(dst), other)) + && "aliasing detected during tranposition, use transposeInPlace() " + "or evaluate the rhs into a temporary using .eval()"); + + } +}; + +template +struct checkTransposeAliasing_impl +{ + static void run(const Derived&, const OtherDerived&) + { + } +}; + + template template void DenseBase::checkTransposeAliasing(const OtherDerived& other) const { - ei_assert((!ei_check_transpose_aliasing_selector::IsTransposed,OtherDerived>::run(ei_extract_data(derived()), other)) - && "aliasing detected during tranposition, use transposeInPlace() or evaluate the rhs into a temporary using .eval()"); + checkTransposeAliasing_impl::run(derived(), other); } #endif