From 725c37ffe0cc46e4140f5dab46df3cb14337f454 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Sat, 6 Jun 2020 01:31:07 +0200 Subject: [PATCH] QVariant: move and swap in the move assignment operator And not pure swap. As per policy, QVariant must leave the rhs empty. Change-Id: I2d5e0f584c4d4fffd05a0a5bfae27ddcb72430e9 Reviewed-by: Marc Mutz --- src/corelib/kernel/qvariant.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/kernel/qvariant.h b/src/corelib/kernel/qvariant.h index d8ac0324ac..2cc09ba616 100644 --- a/src/corelib/kernel/qvariant.h +++ b/src/corelib/kernel/qvariant.h @@ -271,7 +271,7 @@ class Q_CORE_EXPORT QVariant inline QVariant(QVariant &&other) noexcept : d(other.d) { other.d = Private(); } inline QVariant &operator=(QVariant &&other) noexcept - { qSwap(d, other.d); return *this; } + { QVariant moved(std::move(other)); swap(moved); return *this; } inline void swap(QVariant &other) noexcept { qSwap(d, other.d); }