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 fc8dad2f10.

Pick-to: 6.5
Task-number: QTBUG-109842
Change-Id: I165af2a786aa0ba28b8dcd039a500f3494bc29a9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Marc Mutz 2023-01-20 13:55:31 +01:00
parent c54416a06c
commit 577276d12c

View File

@ -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