Centralize the wchar_t == char16_t check on Windows

Don't push it onto every TU that includes QChar (... approx.
everything that uses Qt).

Change-Id: I4a07ce9e38a347b45315db93b0c5b90c20bacdbc
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
Giuseppe D'Angelo 2020-11-16 03:06:10 +01:00
parent befa3729db
commit 29942dcbb1
2 changed files with 3 additions and 3 deletions

View File

@ -132,6 +132,9 @@ static_assert(QT_POINTER_SIZE == sizeof(void *), "QT_POINTER_SIZE defined incorr
static_assert(sizeof(float) == 4, "Qt assumes that float is 32 bits");
static_assert(sizeof(char16_t) == 2, "Qt assumes that char16_t is 16 bits");
static_assert(sizeof(char32_t) == 4, "Qt assumes that char32_t is 32 bits");
#if defined(Q_OS_WIN)
static_assert(sizeof(wchar_t) == sizeof(char16_t));
#endif
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,

View File

@ -116,9 +116,6 @@ public:
constexpr Q_IMPLICIT QChar(SpecialCharacter s) noexcept : ucs(char16_t(s)) {} // implicit
constexpr Q_IMPLICIT QChar(QLatin1Char ch) noexcept : ucs(ch.unicode()) {} // implicit
constexpr Q_IMPLICIT QChar(char16_t ch) noexcept : ucs(ch) {} // implicit
#if defined(Q_OS_WIN)
static_assert(sizeof(wchar_t) == sizeof(char16_t));
#endif
#if defined(Q_OS_WIN) || defined(Q_CLANG_QDOC)
constexpr Q_IMPLICIT QChar(wchar_t ch) noexcept : ucs(char16_t(ch)) {} // implicit
#endif