From 60655cbbbbe060a0c91b7c7e00b66d784b3454e7 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Sun, 30 Apr 2023 01:00:47 +0200 Subject: [PATCH] Make QSlotObject helpers usable for SFINAE Disable if any of the types used in the old-style connections is involved. Change-Id: Ie22c73704370c7f239d7303b555a0b572d2b4f22 Reviewed-by: Thiago Macieira --- src/corelib/kernel/qobjectdefs_impl.h | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/corelib/kernel/qobjectdefs_impl.h b/src/corelib/kernel/qobjectdefs_impl.h index f430749e474..4158851c057 100644 --- a/src/corelib/kernel/qobjectdefs_impl.h +++ b/src/corelib/kernel/qobjectdefs_impl.h @@ -15,6 +15,8 @@ QT_BEGIN_NAMESPACE class QObject; class QObjectPrivate; +class QMetaMethod; +class QByteArray; namespace QtPrivate { template struct RemoveRef { typedef T Type; }; @@ -339,7 +341,13 @@ namespace QtPrivate { not compatible with the \a ExpectedArguments, otherwise returns >= 0. */ template - constexpr int inline countMatchingArguments() + inline constexpr std::enable_if_t, + std::is_same, QMetaMethod>, + std::is_convertible, + std::is_same, QMetaMethod> + >, + int> + countMatchingArguments() { using ExpectedArguments = typename QtPrivate::FunctionPointer::Arguments; using Actual = std::decay_t; @@ -464,19 +472,21 @@ namespace QtPrivate { template struct ContextTypeForFunctor, - std::is_member_function_pointer>> - > + std::enable_if_t, + std::is_member_function_pointer + > + > > { using ContextType = QObject; }; template struct ContextTypeForFunctor>, + std::enable_if_t>, std::is_member_function_pointer, - std::is_convertible::Object *, QObject *>> - > + std::is_convertible::Object *, QObject *> + > + > > { using ContextType = typename QtPrivate::FunctionPointer::Object;