From 55e6822bc830bf74792733e06b5b0d88aa563c5f Mon Sep 17 00:00:00 2001 From: Ahmad Samir Date: Sat, 18 Nov 2023 14:36:01 +0200 Subject: [PATCH] Fix a compiler warning (GCC 13.2.1) -Wpessimizing-move src/testlib/qpropertytesthelper_p.h:204:38: warning: moving a temporary object prevents copy elision [-Wpessimizing-move] 204 | if (std::unique_ptr helperObj = std::move(helperConstructor())) { | ^~~~~~~~~ Amends f5a5c59918021b0bf9a43e6130df2a3f02ea5b97. Pick-to: 6.5 Change-Id: Ie050aa4294289df34347c8f6cbcdce7ff2b784a9 Reviewed-by: Marc Mutz (cherry picked from commit 6335685a1b4b16d179264d27227881cffcf9cae9) Reviewed-by: Qt Cherry-pick Bot --- src/testlib/qpropertytesthelper_p.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/testlib/qpropertytesthelper_p.h b/src/testlib/qpropertytesthelper_p.h index 23fc0477f50..c691802a390 100644 --- a/src/testlib/qpropertytesthelper_p.h +++ b/src/testlib/qpropertytesthelper_p.h @@ -201,7 +201,7 @@ void testReadWritePropertyBasics( QCOMPARE(spy->size(), 4); // test binding loop - if (std::unique_ptr helperObj = std::move(helperConstructor())) { + if (std::unique_ptr helperObj = helperConstructor()) { // Reset to 'initial', so that the binding loop test could check the // 'changed' value, because some tests already rely on the 'instance' to // have the 'changed' value once this test passes @@ -338,7 +338,7 @@ void testWriteOncePropertyBasics( // Create a binding that sets the 'changed' value to the property. // This also tests binding loops. QVERIFY(!bindable.hasBinding()); - std::unique_ptr helperObj(std::move(helperConstructor())); + std::unique_ptr helperObj = helperConstructor(); QProperty propSetter(changed); // if the helperConstructor() returns nullptr const QPropertyBinding binding = helperObj ? Qt::makePropertyBinding([&]() {