diff options
author | Olivier Goffart <ogoffart@woboq.com> | 2015-02-22 10:02:08 +0100 |
---|---|---|
committer | Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> | 2015-03-18 07:33:19 +0000 |
commit | 7c77013c7f6ec57cd1b1faf3b480c40a619067c8 (patch) | |
tree | fed2bafa9d5bbc6545557de2490d8f00bf127c78 /tests/auto/corelib/kernel | |
parent | 59c402417122e2ec2ee3c49b5768646581103d47 (diff) |
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<T>::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 <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/corelib/kernel')
-rw-r--r-- | tests/auto/corelib/kernel/qobject/tst_qobject.cpp | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp index 94242607f0..263cc5a07a 100644 --- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp +++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. -** Copyright (C) 2013 Olivier Goffart <ogoffart@woboq.com> +** Copyright (C) 2015 Olivier Goffart <ogoffart@woboq.com> ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. @@ -127,6 +127,7 @@ private slots: void connectConvert(); void connectWithReference(); void connectManyArguments(); + void connectForwardDeclare(); void returnValue_data(); void returnValue(); void returnValue2_data(); @@ -5208,6 +5209,24 @@ void tst_QObject::connectManyArguments() QCOMPARE(ManyArgumentNamespace::count, 12); } +class ForwardDeclared; + +class ForwardDeclareArguments : public QObject +{ + Q_OBJECT +signals: + void mySignal(const ForwardDeclared&); +public slots: + void mySlot(const ForwardDeclared&) {} +}; + +void tst_QObject::connectForwardDeclare() +{ + ForwardDeclareArguments ob; + // it should compile + QVERIFY(connect(&ob, &ForwardDeclareArguments::mySignal, &ob, &ForwardDeclareArguments::mySlot, Qt::QueuedConnection)); +} + class ReturnValue : public QObject { friend class tst_QObject; Q_OBJECT |