tst_QUrlQuery: fix Clang 15 -Wself-move
Says Clang 15: tst_qurlquery.cpp:193:11: warning: explicitly moving variable of type 'QUrlQuery' to itself [-Wself-move] moved = std::move(moved); ~~~~~ ^ ~~~~~ It's amazing how little it takes to throw this warning off guards: just use an alising reference instead of the same variable. Makes you wonder whether the time spent on detecting such trivialities in the compiler is really well spent. Amends fc8dad2f10e7976cfa778ca7d75e651012629b21. Pick-to: 6.5 Task-number: QTBUG-109842 Change-Id: I165af2a786aa0ba28b8dcd039a500f3494bc29a9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
c54416a06c
commit
577276d12c
@ -190,11 +190,17 @@ void tst_QUrlQuery::constructing()
|
|||||||
QCOMPARE(moved, copy);
|
QCOMPARE(moved, copy);
|
||||||
|
|
||||||
// self move-assign
|
// self move-assign
|
||||||
moved = std::move(moved);
|
{
|
||||||
|
auto &self = moved; // prevent -Wself-move
|
||||||
|
moved = std::move(self);
|
||||||
|
}
|
||||||
QCOMPARE(moved, copy);
|
QCOMPARE(moved, copy);
|
||||||
|
|
||||||
// self move-assign of moved-from (Hinnant Criterion)
|
// 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
|
// shouldn't crash; here, or further down
|
||||||
|
|
||||||
// copy-assign to moved-from object
|
// copy-assign to moved-from object
|
||||||
|
Loading…
x
Reference in New Issue
Block a user