Skip to content

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

Open
@HOMODELUNA

Description

@HOMODELUNA

Position

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:

    struct on_error_notification : public base {
        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; }
        void out(std::ostream& os) const override {
            os << "on_error(";
            os << rxu::what(ep);
            os << ")";
        }
        bool equals(const typename base::type& other) const override {
            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;
        }
        void accept(const typename base::observer_type& o) const & override{
            o.on_error(ep);
        }

        void accept(const typename 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions