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>
This commit is contained in:
Volker Hilsheimer 2019-10-09 22:38:58 +02:00
parent 28798478ba
commit 31f07f3114

View File

@ -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