Commit f72ca464 authored by Milian Wolff's avatar Milian Wolff
Browse files

Forbid self-assignment for move operations of repository items

This was suggested by Igor Kushnir, as such an operation is
not valid as per https://isocpp.org/wiki/faq/assignment-operators
parent 1e0f3965
......@@ -68,9 +68,7 @@ struct ItemRepositoryReferenceCounting {
static void moveIndex(Item* lhs, unsigned int& lhs_index, Item* rhs, unsigned int& rhs_index,
unsigned int emptyIndex)
{
if (lhs == rhs) {
return;
}
Q_ASSERT_X(lhs != rhs, Q_FUNC_INFO, "Self-assignment is not valid for move assignment.");
const auto lhsShouldDoDUChainReferenceCounting = shouldDoDUChainReferenceCounting(lhs);
const auto rhsShouldDoDUChainReferenceCounting = shouldDoDUChainReferenceCounting(rhs);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment