Fix Clang 3.3 warning on using an undefined inline function

Clang doesn't like forward-declared inline functions.

 qmetatype.h:70:29: error: inline function
      'qMetaTypeId<QtMetaTypePrivate::QPairVariantInterfaceImpl>' is not defined [-Werror,-Wundefined-inline]
 inline Q_DECL_CONSTEXPR int qMetaTypeId();
                            ^
 qmetatype.h:1463:30: note: used here
            const int toId = qMetaTypeId<QtMetaTypePrivate::QPairVariantInterfaceImpl>();
                             ^

Change-Id: I1454af5cce56512f0b3d63cfaf51a536207fc511
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
This commit is contained in:
Thiago Macieira 2013-09-04 23:23:20 -07:00 committed by The Qt Project
parent 3f6ed5566f
commit 6b7a841cb4

View File

@ -1458,18 +1458,7 @@ namespace QtPrivate
template<typename T>
struct IsMetaTypePair<T, true>
{
static bool registerConverter(int id)
{
const int toId = qMetaTypeId<QtMetaTypePrivate::QPairVariantInterfaceImpl>();
if (!QMetaType::hasRegisteredConverterFunction(id, toId)) {
static const QtMetaTypePrivate::QPairVariantInterfaceConvertFunctor<T> o;
static const QtPrivate::ConverterFunctor<T,
QtMetaTypePrivate::QPairVariantInterfaceImpl,
QtMetaTypePrivate::QPairVariantInterfaceConvertFunctor<T> > f(o);
return QMetaType::registerConverterFunction(&f, id, toId);
}
return true;
}
inline static bool registerConverter(int id);
};
template<typename T>
@ -1978,6 +1967,21 @@ Q_DECLARE_METATYPE(QtMetaTypePrivate::QPairVariantInterfaceImpl)
QT_BEGIN_NAMESPACE
template <typename T>
inline bool QtPrivate::IsMetaTypePair<T, true>::registerConverter(int id)
{
const int toId = qMetaTypeId<QtMetaTypePrivate::QPairVariantInterfaceImpl>();
if (!QMetaType::hasRegisteredConverterFunction(id, toId)) {
static const QtMetaTypePrivate::QPairVariantInterfaceConvertFunctor<T> o;
static const QtPrivate::ConverterFunctor<T,
QtMetaTypePrivate::QPairVariantInterfaceImpl,
QtMetaTypePrivate::QPairVariantInterfaceConvertFunctor<T> > f(o);
return QMetaType::registerConverterFunction(&f, id, toId);
}
return true;
}
#ifndef Q_QDOC
template<typename T>
#endif