Fix cast-function-type gcc 8 warning

Gcc 8 now warns against casting functions taking references to
functions taking pointers:

warning: cast between incompatible function types from ‘QVariant (*)(const int&, const int&, double)’ to
‘QVariant (*)(const void*, const void*, double)’ [-Werror=cast-function-type]

Suppressed by casting over void(*)().

Change-Id: I48bee53253b8e87110e8a49efa761fc2add89c5a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Allan Sandfeld Jensen 2018-01-16 13:46:28 +01:00
parent bfc96c9c0e
commit 0ffc39806e
2 changed files with 2 additions and 2 deletions

View File

@ -448,7 +448,7 @@ void QVariantAnimation::registerInterpolator(QVariantAnimation::Interpolator fun
template<typename T> static inline QVariantAnimation::Interpolator castToInterpolator(QVariant (*func)(const T &from, const T &to, qreal progress))
{
return reinterpret_cast<QVariantAnimation::Interpolator>(func);
return reinterpret_cast<QVariantAnimation::Interpolator>(reinterpret_cast<void(*)()>(func));
}
QVariantAnimation::Interpolator QVariantAnimationPrivate::getInterpolator(int interpolationType)

View File

@ -113,7 +113,7 @@ private:
template <typename T>
void qRegisterAnimationInterpolator(QVariant (*func)(const T &from, const T &to, qreal progress)) {
QVariantAnimation::registerInterpolator(reinterpret_cast<QVariantAnimation::Interpolator>(func), qMetaTypeId<T>());
QVariantAnimation::registerInterpolator(reinterpret_cast<QVariantAnimation::Interpolator>(reinterpret_cast<void(*)()>(func)), qMetaTypeId<T>());
}
#endif //QT_NO_ANIMATION