diff options
author | Ahmad Samir <a.samirh78@gmail.com> | 2023-11-18 14:36:01 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2023-11-20 22:19:19 +0000 |
commit | 6335685a1b4b16d179264d27227881cffcf9cae9 (patch) | |
tree | 34b6fe79ed57c13d950ed0815488d3f6f4fefcf1 /src/testlib | |
parent | 87dd49f63894010f145cd244701f94bb8ce69483 (diff) |
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<TestedClass> helperObj = std::move(helperConstructor())) {
| ^~~~~~~~~
Amends f5a5c59918021b0bf9a43e6130df2a3f02ea5b97.
Pick-to: 6.6 6.5
Change-Id: Ie050aa4294289df34347c8f6cbcdce7ff2b784a9
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Diffstat (limited to 'src/testlib')
-rw-r--r-- | src/testlib/qpropertytesthelper_p.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/testlib/qpropertytesthelper_p.h b/src/testlib/qpropertytesthelper_p.h index 23fc0477f5..c691802a39 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<TestedClass> helperObj = std::move(helperConstructor())) { + if (std::unique_ptr<TestedClass> 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<TestedClass> helperObj(std::move(helperConstructor())); + std::unique_ptr<TestedClass> helperObj = helperConstructor(); QProperty<PropertyType> propSetter(changed); // if the helperConstructor() returns nullptr const QPropertyBinding<PropertyType> binding = helperObj ? Qt::makePropertyBinding([&]() { |