Add default value for qHash's 'seed' argument for QOpenGLVersionProfile/Status

Although template<typename T> inline uint qHash(const T &t, uint seed) from
qhash.h is never instantiated because we have the two-argument version of
qHash() for both QOpenGLVersionProfile and QOpenGLVersionStatus, we need
the default argument, as the template in qhash.h uses noexcept, which
is evaluated regardless of instantiation, and uses qHash(t) without a
seed.

This behavior seems to not be the case with Apple clang 4.2, but has
been observed with Apple clang 4.1, Clang 3.2, and GCC 4.8.

Change-Id: If70e93f64eb9675a7c3ef7897ced2c6aebbec2d6
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
This commit is contained in:
Tor Arne Vestbø 2013-04-12 16:08:41 +02:00 committed by The Qt Project
parent aa009e3dcc
commit 8e127d9df8
2 changed files with 2 additions and 2 deletions

View File

@ -101,7 +101,7 @@ private:
QOpenGLVersionProfilePrivate* d;
};
inline uint qHash(const QOpenGLVersionProfile &v, uint seed)
inline uint qHash(const QOpenGLVersionProfile &v, uint seed = 0)
{
return qHash(static_cast<int>(v.profile() * 1000)
+ v.version().first * 100 + v.version().second * 10, seed);

View File

@ -91,7 +91,7 @@ struct QOpenGLVersionStatus
OpenGLStatus status;
};
inline uint qHash(const QOpenGLVersionStatus &v, uint seed)
inline uint qHash(const QOpenGLVersionStatus &v, uint seed = 0)
{
return qHash(static_cast<int>(v.status * 1000)
+ v.version.first * 100 + v.version.second * 10, seed);