From 2bf186a2e598a4bccdc4979085e8e4d963a3819d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Wed, 25 Jan 2012 17:40:24 +0100 Subject: Allow function types to be registered without workarounds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Commit 4b8ceb41aed352f10d36db5284453f425dbc5f3f added the requirement that pointed-to types need to be registered when registering pointer types. Unfortunately, the implementation also affects function pointer types. This change whitelists 0, 1, 2 and 3 argument functions as not deriving from QObject, forgoing the need to workaround details of the type registration implementation when registering those function pointer types. Change-Id: I4d855e9d70a8179a6e31b84623ad5bf063e0d6d8 Reviewed-by: Jędrzej Nowacki Reviewed-by: Olivier Goffart Reviewed-by: Stephen Kelly --- tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp') diff --git a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp index 82e59cef76..be13b39e7e 100644 --- a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp +++ b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp @@ -931,5 +931,18 @@ void tst_QMetaType::automaticTemplateRegistration() } } +// Compile-time test, it should be possible to register function pointer types +class Undefined; + +typedef Undefined (*UndefinedFunction0)(); +typedef Undefined (*UndefinedFunction1)(Undefined); +typedef Undefined (*UndefinedFunction2)(Undefined, Undefined); +typedef Undefined (*UndefinedFunction3)(Undefined, Undefined, Undefined); + +Q_DECLARE_METATYPE(UndefinedFunction0); +Q_DECLARE_METATYPE(UndefinedFunction1); +Q_DECLARE_METATYPE(UndefinedFunction2); +Q_DECLARE_METATYPE(UndefinedFunction3); + QTEST_MAIN(tst_QMetaType) #include "tst_qmetatype.moc" -- cgit v1.2.3