diff --git a/src/corelib/time/qdatetime.cpp b/src/corelib/time/qdatetime.cpp index dcb9896d685..6bed609f463 100644 --- a/src/corelib/time/qdatetime.cpp +++ b/src/corelib/time/qdatetime.cpp @@ -3016,7 +3016,7 @@ inline QDateTime::Data::Data(Qt::TimeSpec spec) } inline QDateTime::Data::Data(const Data &other) noexcept - : d(other.d) + : data(other.data) { if (!isShort()) { // check if we could shrink @@ -3033,17 +3033,17 @@ inline QDateTime::Data::Data(const Data &other) noexcept } inline QDateTime::Data::Data(Data &&other) noexcept - : d(other.d) + : data(other.data) { // reset the other to a short state Data dummy; Q_ASSERT(dummy.isShort()); - other.d = dummy.d; + other.data = dummy.data; } inline QDateTime::Data &QDateTime::Data::operator=(const Data &other) noexcept { - if (d == other.d) + if (isShort() ? data == other.data : d == other.d) return *this; auto x = d; diff --git a/src/corelib/time/qdatetime.h b/src/corelib/time/qdatetime.h index a2f6198d08c..3cef349bd82 100644 --- a/src/corelib/time/qdatetime.h +++ b/src/corelib/time/qdatetime.h @@ -266,6 +266,8 @@ class Q_CORE_EXPORT QDateTime #if Q_BYTE_ORDER == Q_BIG_ENDIAN quintptr status : 8; #endif + friend constexpr bool operator==(const ShortData &lhs, const ShortData &rhs) + { return lhs.status == rhs.status && lhs.msecs == rhs.msecs; } }; union Data {