From 7c77013c7f6ec57cd1b1faf3b480c40a619067c8 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Sun, 22 Feb 2015 10:02:08 +0100 Subject: Fix source incompatibility while connecting signals with forward declared arguments QObject::connect tries to determine if the arguments are registered metatypes. This used to work even for arguments that were forward declared. But now, the metatype system tries to call QtPrivate::IsQEnumHelper::Value to know if it is registered. That fails on gcc if T is forward declared. Apparently gcc needs to know the full type of T to pass it in the ellipsis function, even within a sizeof expression. So change the ellipsis expression to a template one. Task-number: QTBUG-44496 Change-Id: I7fa07bd3cde470b134c2ec53b0d581333d16a6f1 Reviewed-by: Thiago Macieira --- src/corelib/kernel/qmetatype.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h index 2c2dbeef9d..55f8fc9b2c 100644 --- a/src/corelib/kernel/qmetatype.h +++ b/src/corelib/kernel/qmetatype.h @@ -1364,15 +1364,15 @@ namespace QtPrivate enum { Value = sizeof(checkType(static_cast(0))) == sizeof(void*) }; }; - char qt_getEnumMetaObject(...); - char qt_getEnumMetaObject(); // Workaround bugs in MSVC. + template char qt_getEnumMetaObject(const T&); template struct IsQEnumHelper { static const T &declval(); - // If the type was declared with Q_ENUM, the friend qt_getEnumMetaObject(T) declared in the + // If the type was declared with Q_ENUM, the friend qt_getEnumMetaObject() declared in the // Q_ENUM macro will be chosen by ADL, and the return type will be QMetaObject*. - // Otherwise the chosen overload will be qt_getEnumMetaObject(...) which returne 'char' + // Otherwise the chosen overload will be the catch all template function + // qt_getEnumMetaObject(T) which returns 'char' enum { Value = sizeof(qt_getEnumMetaObject(declval())) == sizeof(QMetaObject*) }; }; -- cgit v1.2.3