From 6b7a841cb45a41f246040d01353dfeed38e0c99b Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 4 Sep 2013 23:23:20 -0700 Subject: [PATCH] Fix Clang 3.3 warning on using an undefined inline function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Clang doesn't like forward-declared inline functions. qmetatype.h:70:29: error: inline function 'qMetaTypeId' is not defined [-Werror,-Wundefined-inline] inline Q_DECL_CONSTEXPR int qMetaTypeId(); ^ qmetatype.h:1463:30: note: used here const int toId = qMetaTypeId(); ^ Change-Id: I1454af5cce56512f0b3d63cfaf51a536207fc511 Reviewed-by: Jędrzej Nowacki Reviewed-by: Stephen Kelly --- src/corelib/kernel/qmetatype.h | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h index 005199080d..87d730096b 100644 --- a/src/corelib/kernel/qmetatype.h +++ b/src/corelib/kernel/qmetatype.h @@ -1458,18 +1458,7 @@ namespace QtPrivate template struct IsMetaTypePair { - static bool registerConverter(int id) - { - const int toId = qMetaTypeId(); - if (!QMetaType::hasRegisteredConverterFunction(id, toId)) { - static const QtMetaTypePrivate::QPairVariantInterfaceConvertFunctor o; - static const QtPrivate::ConverterFunctor > f(o); - return QMetaType::registerConverterFunction(&f, id, toId); - } - return true; - } + inline static bool registerConverter(int id); }; template @@ -1978,6 +1967,21 @@ Q_DECLARE_METATYPE(QtMetaTypePrivate::QPairVariantInterfaceImpl) QT_BEGIN_NAMESPACE +template +inline bool QtPrivate::IsMetaTypePair::registerConverter(int id) +{ + const int toId = qMetaTypeId(); + if (!QMetaType::hasRegisteredConverterFunction(id, toId)) { + static const QtMetaTypePrivate::QPairVariantInterfaceConvertFunctor o; + static const QtPrivate::ConverterFunctor > f(o); + return QMetaType::registerConverterFunction(&f, id, toId); + } + return true; +} + + #ifndef Q_QDOC template #endif