diff options
author | Timur Pocheptsov <timur.pocheptsov@qt.io> | 2018-07-24 12:36:06 +0200 |
---|---|---|
committer | Timur Pocheptsov <timur.pocheptsov@qt.io> | 2018-07-25 09:44:36 +0000 |
commit | c575977645ece4b8d1e6aaec21daa043da5affa8 (patch) | |
tree | b18be80183e17ba2215e0f4d6b9909c51fce3701 /src/corelib/tools | |
parent | ad8a7f0c50258bb2dd2573f9afda56b3a1e3a377 (diff) |
Fix MSVC builds with /Zc:wchar_t-
208c71768 introduced a problem for our users, who build on Windows with
/Zc:wchar_t-, which makes wchar_t a typedef for the type 'unsigned short',
preventing them from switching to more recent versions of Qt. While MSDN
recommends against this option, we can add more #if-ery to avoid compiler's
bailing out on a constructor's redefinition.
Task-number: QTBUG-65101
Change-Id: I62a1d9b2572f3d4b1f70bcbc3e52e795b1944558
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'src/corelib/tools')
-rw-r--r-- | src/corelib/tools/qchar.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/corelib/tools/qchar.h b/src/corelib/tools/qchar.h index 84df8accc5..8590b91ba3 100644 --- a/src/corelib/tools/qchar.h +++ b/src/corelib/tools/qchar.h @@ -93,7 +93,9 @@ public: Q_STATIC_ASSERT(sizeof(wchar_t) == sizeof(ushort)); #endif #if defined(Q_OS_WIN) || defined(Q_CLANG_QDOC) +# if !defined(_WCHAR_T_DEFINED) || defined(_NATIVE_WCHAR_T_DEFINED) Q_DECL_CONSTEXPR QChar(wchar_t ch) Q_DECL_NOTHROW : ucs(ushort(ch)) {} // implicit +# endif #endif #ifndef QT_NO_CAST_FROM_ASCII |