diff --git a/src/corelib/kernel/qobject.h b/src/corelib/kernel/qobject.h index 49435b97016..182edaf7f2c 100644 --- a/src/corelib/kernel/qobject.h +++ b/src/corelib/kernel/qobject.h @@ -207,6 +207,7 @@ public: "Return type of the slot is not compatible with the return type of the signal."); } else { constexpr int FunctorArgumentCount = QtPrivate::ComputeFunctorArgumentCount, typename SignalType::Arguments>::Value; + [[maybe_unused]] constexpr int SlotArgumentCount = (FunctorArgumentCount >= 0) ? FunctorArgumentCount : 0; typedef typename QtPrivate::FunctorReturnType, typename QtPrivate::List_Left::Value>::Value SlotReturnType; diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp index 73b77932ce4..31345cc3333 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, [=](){});