diff --git a/include/xtensor/core/xassign.hpp b/include/xtensor/core/xassign.hpp index 174ddcdc0..e305b19c7 100644 --- a/include/xtensor/core/xassign.hpp +++ b/include/xtensor/core/xassign.hpp @@ -392,7 +392,7 @@ namespace xt static constexpr bool simd_interface() { - return has_simd_interface() + return data_interface_expression && has_simd_interface() && has_simd_interface(); } diff --git a/test/test_xcomplex.cpp b/test/test_xcomplex.cpp index 920d21b8e..43d1f856a 100644 --- a/test/test_xcomplex.cpp +++ b/test/test_xcomplex.cpp @@ -319,6 +319,16 @@ namespace xt EXPECT_EQ(a(4, 4), cmplx(-123.321L, -123.321L)); } + TEST(xcomplex, assign_to_real_part) + { + using cpx = std::complex; + xt::xtensor a = {cpx(1, 2), cpx(3, 4), cpx(5, 6), cpx(7, 8), cpx(9, 10)}; + xt::xtensor wr = {11, 12, 13, 14, 15}; + xt::real(a) = wr; + xt::xtensor expected = {cpx(11, 2), cpx(12, 4), cpx(13, 6), cpx(14, 8), cpx(15, 10)}; + EXPECT_EQ(a, expected); + } + TEST(xcomplex, build_from_double) { xt::xarray r = {1., 2., 3.};