From 31f07f3114218de758cc8c5b0f5b0d4e83669a5c Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Wed, 9 Oct 2019 22:38:58 +0200 Subject: 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 --- src/corelib/tools/qhashfunctions.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') 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(nullptr), seed); + const void *ptr = nullptr; // work-around for MSVC's reinterpret_cast bug + return qHash(reinterpret_cast(ptr), seed); } template inline uint qHash(const T *key, uint seed = 0) Q_DECL_NOTHROW -- cgit v1.2.3