summaryrefslogtreecommitdiffstats
path: root/src/corelib/global/qglobal.cpp
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2021-01-06 12:28:27 +0100
committerEdward Welbourne <edward.welbourne@qt.io>2021-01-08 12:41:28 +0100
commit7fea8a079f65b090c7d82e0d285ef85e30328da7 (patch)
treeea1e75cfc104639974d6e8c4b00c182fb26e6adc /src/corelib/global/qglobal.cpp
parent4724d017ef2ff84e71fac3d0d04bd25373140c09 (diff)
Assert that wchar_t's size matches one of the unicode character types
This is assumed in various places, so best checked explicitly. Change-Id: I475dcf5cbb60c0272dec560acd2893cff73872ce Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/corelib/global/qglobal.cpp')
-rw-r--r--src/corelib/global/qglobal.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index ee857d61ac..65c72d9abe 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -139,6 +139,8 @@ static_assert(std::numeric_limits<int>::radix == 2,
"Qt assumes binary integers");
static_assert((std::numeric_limits<int>::max() + std::numeric_limits<int>::lowest()) == -1,
"Qt assumes two's complement integers");
+static_assert(sizeof(wchar_t) == sizeof(char32_t) || sizeof(wchar_t) == sizeof(char16_t),
+ "Qt assumes wchar_t is compatible with either char32_t or char16_t");
// While we'd like to check for __STDC_IEC_559__, as per ISO/IEC 9899:2011
// Annex F (C11, normative for C++11), there are a few corner cases regarding