summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2023-06-22 09:53:23 +0200
committerMarc Mutz <marc.mutz@qt.io>2023-06-22 13:20:26 +0000
commit2b9ef2eb44c084d39ef8324cfe1ae42a98b3038f (patch)
treed212460280257673fdfc0570398332733961dd81 /tests/auto/corelib/kernel/qobject/tst_qobject.cpp
parentc33fd574c970eb920a899a9caccb2e6b1838ee19 (diff)
Pacify MSVC compiler incorrectly warning about unused variable
Under some circumstances, MSVC seems to complain about SlotArgumentCount being unused qobject.h(210): warning C4189: 'SlotArgumentCount': local variable is initialized but not referenced note: see reference to function template instantiation 'QMetaObject::Connection QObject::connect<void(__cdecl QAction::* )(bool), main::<lambda_1>>(const QAction *,Func1, const QtPrivate::ContextTypeForFunctor<main::<lambda_1>,void>::ContextType *, Func2 &&,Qt::ConnectionType)' being compiled This is nonsense, as SlotArgumentCount is used in the next line, to construct the list of signal arguments, but the workaround to declare the variable as [[maybe_unused]] is trivial. Add a connect statement to the test case that creates such a connection. This does not produce any warning with or without the attribute (and if it did, the build would fail for CI configuratinos setting -Werror). Pick-to: 6.6 Fixes: QTBUG-114781 Change-Id: I4ee6f7d57c2836ef3dd9741d037d48181af2cdec Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Diffstat (limited to 'tests/auto/corelib/kernel/qobject/tst_qobject.cpp')
-rw-r--r--tests/auto/corelib/kernel/qobject/tst_qobject.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
index 73b77932ce..31345cc333 100644
--- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
+++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
@@ -6075,6 +6075,7 @@ void tst_QObject::connectFunctorArgDifference()
connect(&timer, &QTimer::timeout, [=](){});
connect(&timer, &QTimer::objectNameChanged, [=](const QString &){});
+ connect(&timer, &QTimer::objectNameChanged, this, [](){});
connect(qApp, &QCoreApplication::aboutToQuit, [=](){});
connect(&timer, &QTimer::objectNameChanged, [=](){});