summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2019-10-09 22:38:58 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2019-10-14 20:07:27 +0200
commit31f07f3114218de758cc8c5b0f5b0d4e83669a5c (patch)
tree0b8a90d3a2074bfa137eda19941c74be8597a0fb
parent28798478ba7b10625afdd14d42f0adce1dd18033 (diff)
Fix for compilers that don't allow casting nullptr_t to an integer
Visual Studio 14.0 toolchain at least seems to be broken enough to somehow interpret the cast from nullptr to a quintptr as being ill-formed, inspite of it being valid C++. Change-Id: Ifb29be3af82764cb31fa65409f7e1000ea419498 Fixes: QTBUG-79080 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
-rw-r--r--src/corelib/tools/qhashfunctions.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/corelib/tools/qhashfunctions.h b/src/corelib/tools/qhashfunctions.h
index d013c26d66..d2d8147566 100644
--- a/src/corelib/tools/qhashfunctions.h
+++ b/src/corelib/tools/qhashfunctions.h
@@ -106,7 +106,8 @@ Q_CORE_EXPORT Q_DECL_PURE_FUNCTION uint qt_hash(QStringView key, uint chained =
Q_DECL_CONST_FUNCTION inline uint qHash(std::nullptr_t, uint seed = 0) Q_DECL_NOTHROW
{
- return qHash(reinterpret_cast<quintptr>(nullptr), seed);
+ const void *ptr = nullptr; // work-around for MSVC's reinterpret_cast bug
+ return qHash(reinterpret_cast<quintptr>(ptr), seed);
}
template <class T> inline uint qHash(const T *key, uint seed = 0) Q_DECL_NOTHROW