Skip to content

test errors: ambiguous overload for ‘operator=’, binding reference discards qualifiers #2887

@drew-parsons

Description

@drew-parsons

I'm trying to build xtensor 0.27.1 with xtl 0.8.1 (on a debian linux system).

Build-time tests (with g++) are passing, but runtime tests (tests subdir) using the installed packages are failing with both g++ 15.2.0 and clang 21.1.8.

g++ reports

[ 73%] Building CXX object CMakeFiles/test_xtensor_lib.dir/test_xmasked_view.cpp.o
/usr/bin/g++   -DXSIMD_ENABLE_XTL_COMPLEX=1 -march=native -std=c++20 -Wunused-parameter -Wextra -Wreorder -Wconversion -Wno-sign-conversion  -Wold-style-cast -Wunused-variable -ftemplate-backtrace-limit=0 -O3 -D
NDEBUG -std=gnu++20 -MD -MT CMakeFiles/test_xtensor_lib.dir/test_xmasked_view.cpp.o -MF CMakeFiles/test_xtensor_lib.dir/test_xmasked_view.cpp.o.d -o CMakeFiles/test_xtensor_lib.dir/test_xmasked_view.cpp.o -c /tm
p/autopkgtest.bfBHFS/autopkgtest_tmp/test_xmasked_view.cpp
...
In file included from /usr/include/xtensor/core/xsemantic.hpp:16,
                 from /usr/include/xtensor/views/xstrided_view.hpp:26,
                 from /usr/include/xtensor/core/xoperation.hpp:22,
                 from /usr/include/xtensor/core/xmath.hpp:28,
                 from /usr/include/xtensor/io/xio.hpp:22,
                 from /tmp/autopkgtest.bfBHFS/autopkgtest_tmp/test_xmasked_view.cpp:10:
/usr/include/xtensor/core/xassign.hpp: In instantiation of ‘void xt::stepper_assigner<E1, E2, L>::run() [with E1 = xt::xmasked_view<xt::xarray_container<xt::uvector<double, std::allocator<double> >, xt::layout_t
ype::row_major, xt::svector<long unsigned int, 4, std::allocator<long unsigned int>, true>, xt::xtensor_expression_tag>&, xt::xarray_container<xt::uvector<bool, std::allocator<bool> >, xt::layout_type::row_major
, xt::svector<long unsigned int, 4, std::allocator<long unsigned int>, true>, xt::xtensor_expression_tag>&>; E2 = xt::xbroadcast<const xt::xarray_container<xt::uvector<double, std::allocator<double> >, xt::layou
t_type::row_major, xt::svector<long unsigned int, 4, std::allocator<long unsigned int>, true>, xt::xtensor_expression_tag>&, xt::svector<long unsigned int, 4, std::allocator<long unsigned int>, true> >; xt::layo
ut_type L = xt::layout_type::row_major]’:
...
/usr/include/xtensor/views/xmasked_view.hpp:579:40:   required from ‘xt::xmasked_view<CTD, CTM>::self_type& xt::xmasked_view<CTD, CTM>::operator=(const xt::xexpression<E1>&) [with E = xt::xarray_container<xt::uvector<double, std::allocator<double> >, xt::layout_type::row_major, xt::svector<long unsigned int, 4, std::allocator<long unsigned int>, true>, xt::xtensor_expression_tag>; CTD = xt::xarray_container<xt::uvector<double, std::allocator<double> >, xt::layout_type::row_major, xt::svector<long unsigned int, 4, std::allocator<long unsigned int>, true>, xt::xtensor_expression_tag>&; CTM = xt::xarray_container<xt::uvector<bool, std::allocator<bool> >, xt::layout_type::row_major, xt::svector<long unsigned int, 4, std::allocator<long unsigned int>, true>, xt::xtensor_expression_tag>&; self_type = xt::xmasked_view<xt::xarray_container<xt::uvector<double, std::allocator<double> >, xt::layout_type::row_major, xt::svector<long unsigned int, 4, std::allocator<long unsigned int>, true>, xt::xtensor_expression_tag>&, xt::xarray_container<xt::uvector<bool, std::allocator<bool> >, xt::layout_type::row_major, xt::svector<long unsigned int, 4, std::allocator<long unsigned int>, true>, xt::xtensor_expression_tag>&>]’
  579 |         return semantic_base::operator=(e);
      |                ~~~~~~~~~~~~~~~~~~~~~~~~^~~
/tmp/autopkgtest.bfBHFS/autopkgtest_tmp/test_xmasked_view.cpp:221:23:   required from here
  221 |         masked_data = data2;
      |                       ^~~~~
/usr/include/xtensor/core/xassign.hpp:664:20: error: ambiguous overload for ‘operator=’ (operand types are ‘xt::xmasked_view_stepper<xt::xmasked_view<xt::xarray_container<xt::uvector<double, std::allocator<double> >, xt::layout_type::row_major, xt::svector<long unsigned int, 4, std::allocator<long unsigned int>, true>, xt::xtensor_expression_tag>&, xt::xarray_container<xt::uvector<bool, std::allocator<bool> >, xt::layout_type::row_major, xt::svector<long unsigned int, 4, std::allocator<long unsigned int>, true>, xt::xtensor_expression_tag>&>, false>::reference’ {aka ‘xtl::xmasked_value<double&, bool&>’} and ‘xtl::xmasked_value<double&, bool&>’)
  664 |             *m_lhs = conditional_cast<needs_cast, result_type>(*m_rhs);
      |             ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/xtensor/core/xassign.hpp:664:20: note: there are 4 candidates
In file included from /usr/include/xtensor/views/xmasked_view.hpp:20,
                 from /tmp/autopkgtest.bfBHFS/autopkgtest_tmp/test_xmasked_view.cpp:12:
/usr/include/xtl/xmasked_value.hpp:92:9: note: candidate 1: ‘xtl::xmasked_value<T, B>& xtl::xmasked_value<T, B>::operator=(const T1&) [with T1 = xtl::xmasked_value<double&, bool&>; T = double&; B = bool&]’
   92 |         DEFINE_ASSIGN_OPERATOR(=);
      |         ^~~~~~~~~~~~~~~~~~~~~~
/usr/include/xtl/xmasked_value.hpp:92:9: note: candidate 2: ‘xtl::xmasked_value<T, B>& xtl::xmasked_value<T, B>::operator=(const xtl::xmasked_value<T1, B1>&) [with T1 = double&; B1 = bool&; T = double&; B = bool&]’
   92 |         DEFINE_ASSIGN_OPERATOR(=);
      |         ^~~~~~~~~~~~~~~~~~~~~~
/usr/include/xtl/xmasked_value.hpp:30:11: note: candidate 3: ‘xtl::xmasked_value<double&, bool&>& xtl::xmasked_value<double&, bool&>::operator=(const xtl::xmasked_value<double&, bool&>&)’ (deleted)
   30 |     class xmasked_value
      |           ^~~~~~~~~~~~~
/usr/include/xtl/xmasked_value.hpp:30:11: note: candidate 4: ‘xtl::xmasked_value<double&, bool&>& xtl::xmasked_value<double&, bool&>::operator=(xtl::xmasked_value<double&, bool&>&&)’ (deleted)
/usr/include/xtensor/core/xassign.hpp: In instantiation of ‘void xt::stepper_assigner<E1, E2, L>::run() [with E1 = xt::xmasked_view<xt::xarray_container<xt::uvector<double, std::allocator<double> >, xt::layout_t
ype::row_major, xt::svector<long unsigned int, 4, std::allocator<long unsigned int>, true>, xt::xtensor_expression_tag>&, xt::xarray_container<xt::uvector<bool, std::allocator<bool> >, xt::layout_type::row_major
, xt::svector<long unsigned int, 4, std::allocator<long unsigned int>, true>, xt::xtensor_expression_tag>&>; E2 = xt::xarray_container<xt::uvector<double, std::allocator<double> >, xt::layout_type::row_major, xt
::svector<long unsigned int, 4, std::allocator<long unsigned int>, true>, xt::xtensor_expression_tag>; xt::layout_type L = xt::layout_type::row_major]’:
/usr/include/xtensor/core/xassign.hpp:476:97:   required from ‘static void xt::xexpression_assigner_base<xt::xtensor_expression_tag>::assign_data(xt::xexpression<D>&, const xt::xexpression<E2>&, bool) [with E1 =
 xt::xmasked_view<xt::xarray_container<xt::uvector<double, std::allocator<double> >, xt::layout_type::row_major, xt::svector<long unsigned int, 4, std::allocator<long unsigned int>, true>, xt::xtensor_expression
_tag>&, xt::xarray_container<xt::uvector<bool, std::allocator<bool> >, xt::layout_type::row_major, xt::svector<long unsigned int, 4, std::allocator<long unsigned int>, true>, xt::xtensor_expression_tag>&>; E2 = xt::xarray_container<xt::uvector<double, std::allocator<double> >, xt::layout_type::row_major, xt::svector<long unsigned int, 4, std::allocator<long unsigned int>, true>, xt::xtensor_expression_tag>]’
  476 |             stepper_assigner<E1, E2, default_assignable_layout(E1::static_layout)>(de1, de2).run();
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions