QDateTime: work around bitfield bug on msvc x86

Somehow, when mixing types in a bitfield, MSVC will use a lot
more space than expected. So ShortData ended up being 16 bytes
causing various static_asserts to trigger.

Change-Id: Ia0032e71621772db27e2917d9c71598046730107
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit a901afcd79fe0ac7cf257f2ed45c72a7cfaf028a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Mårten Nordheim 2022-08-30 12:31:36 +02:00 committed by Qt Cherry-pick Bot
parent a09b9aaba9
commit 352cbfd3c8

View File

@ -253,18 +253,25 @@ class QDateTimePrivate;
class Q_CORE_EXPORT QDateTime
{
struct ShortData {
#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
quintptr status : 8;
#endif
#if QT_VERSION >= QT_VERSION_CHECK(7,0,0) || defined(QT_BOOTSTRAPPED)
# if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
qint64 status : 8;
# endif
qint64 msecs : 56;
# if Q_BYTE_ORDER == Q_BIG_ENDIAN
qint64 status : 8;
# endif
#else
# if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
quintptr status : 8;
# endif
// note: this is only 24 bits on 32-bit systems...
qintptr msecs : sizeof(void *) * 8 - 8;
#endif
#if Q_BYTE_ORDER == Q_BIG_ENDIAN
# if Q_BYTE_ORDER == Q_BIG_ENDIAN
quintptr status : 8;
# endif
#endif
};