Skip to content

assert in move assign operator #4

@J-Richter

Description

@J-Richter

The operator MoveAssignmentBase & operator=(MoveAssignmentBase && rhs) has this assert:

assert(this->has_value() == rhs.has_value());

It triggers in our code. The reason is that

this->AssignValue(std::move(rhs.GetPayload()));

might set rhs to the empty state if the moved-from-state happens to be the empty-state. I don't know what the assert is supposed to protect. It looks unnecessary. Could there be problems if I remove it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions