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.5 Change-Id: Ie050aa4294289df34347c8f6cbcdce7ff2b784a9 Reviewed-by: Marc Mutz <marc.mutz@qt.io> (cherry picked from commit 6335685a1b4b16d179264d27227881cffcf9cae9) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
f2dc25239e
commit
55e6822bc8
@ -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([&]() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user