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. Task-number: QTBUG-109842 Change-Id: I165af2a786aa0ba28b8dcd039a500f3494bc29a9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 577276d12c7b40d97a113a9daadcbd1f321b686f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
4776260a45
commit
6669446150
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user