diff --git a/tests/auto/corelib/io/qurlquery/tst_qurlquery.cpp b/tests/auto/corelib/io/qurlquery/tst_qurlquery.cpp index 4735d33eb2..2ff1ba43ae 100644 --- a/tests/auto/corelib/io/qurlquery/tst_qurlquery.cpp +++ b/tests/auto/corelib/io/qurlquery/tst_qurlquery.cpp @@ -190,11 +190,17 @@ void tst_QUrlQuery::constructing() QCOMPARE(moved, copy); // self move-assign - moved = std::move(moved); + { + auto &self = moved; // prevent -Wself-move + moved = std::move(self); + } QCOMPARE(moved, copy); // self move-assign of moved-from (Hinnant Criterion) - other = std::move(other); + { + auto &self = other; // prevent -Wself-move + other = std::move(self); + } // shouldn't crash; here, or further down // copy-assign to moved-from object