summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@digia.com>2013-04-12 16:08:41 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-04-15 17:45:20 +0200
commit8e127d9df868952d41c8aa622b6d4ead8139a835 (patch)
treedb562e8f385151506194ff99978537f2c1c172bd
parentaa009e3dcc7ab47b27ec7e56a2b19fb835b04ee1 (diff)
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>
-rw-r--r--src/gui/kernel/qopenglcontext.h2
-rw-r--r--src/gui/opengl/qopenglversionfunctions.h2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/gui/kernel/qopenglcontext.h b/src/gui/kernel/qopenglcontext.h
index 419fd541eb..bfdb8921af 100644
--- a/src/gui/kernel/qopenglcontext.h
+++ b/src/gui/kernel/qopenglcontext.h
@@ -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);
diff --git a/src/gui/opengl/qopenglversionfunctions.h b/src/gui/opengl/qopenglversionfunctions.h
index 833c5adf9f..304b944de8 100644
--- a/src/gui/opengl/qopenglversionfunctions.h
+++ b/src/gui/opengl/qopenglversionfunctions.h
@@ -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);