You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
no match for 'operator=' (operand types are 'const rxcpp::util::error_ptr' {aka 'const std::__exception_ptr::exception_ptr'} and 'std::remove_reference<const std::__exception_ptr::exception_ptr&>::type' {aka 'const std::__exception_ptr::exception_ptr'}) #611
error: In file included from /root/mock-ability/build/.packages/r/rxcpp/9002d9be/725e51fe81b74141ade9efbd3ccaf900/include/rxcpp/rx-includes.hpp:206,
from /root/mock-ability/build/.packages/r/rxcpp/9002d9be/725e51fe81b74141ade9efbd3ccaf900/include/rxcpp/rx.hpp:8,
from /tmp/.xmake0/250305/_F49A970EF5E44D8A9D9305921FD57B9F.cpp:4:
/root/mock-ability/build/.packages/r/rxcpp/9002d9be/725e51fe81b74141ade9efbd3ccaf900/include/rxcpp/rx-notification.hpp: In member function 'rxcpp::notifications::notification<T>::on_error_notification& rxcpp::notifications::notification<T>::on_error_notification::operator=(rxcpp::notifications::notification<T>::on_error_notification)':
/root/mock-ability/build/.packages/r/rxcpp/9002d9be/725e51fe81b74141ade9efbd3ccaf900/include/rxcpp/rx-notification.hpp:153:88: error: no match for 'operator=' (operand types are 'const rxcpp::util::error_ptr' {aka 'const std::__exception_ptr::exception_ptr'} and 'std::remove_reference<const std::__exception_ptr::exception_ptr&>::type' {aka 'const std::__exception_ptr::exception_ptr'})
153 | on_error_notification& operator=(on_error_notification o) { ep = std::move(o.ep); return *this; }
|
Problem
in rx-hotification.hpp, on_error_notification has a const error_ptr, it can't e reassigned:
structon_error_notification : publicbase {
on_error_notification(rxu::error_ptr ep) : ep(ep) {
}
on_error_notification(const on_error_notification& o) : ep(o.ep) {}
on_error_notification(const on_error_notification&& o) : ep(std::move(o.ep)) {}
// here reassigned a const std::exception_ptr
on_error_notification& operator=(on_error_notification o) { ep = std::move(o.ep); return *this; }
voidout(std::ostream& os) constoverride {
os << "on_error(";
os << rxu::what(ep);
os << ")";
}
boolequals(consttypename base::type& other) constoverride {
bool result = false;
// not trying to compare exceptions
other->accept(make_subscriber<T>(make_observer_dynamic<T>([](T){}, [&result](rxu::error_ptr){
result = true;
})));
return result;
}
voidaccept(consttypename base::observer_type& o) const & override{
o.on_error(ep);
}
voidaccept(consttypename base::observer_type& o) && override{
o.on_error(ep);
}
const rxu::error_ptr ep; // it is declared as const
};
Solution(maybe)
is this error_ptr defined const on_purpose? if not, maybe it should be declared without const.