diff --git a/src/corelib/time/qdatetime.cpp b/src/corelib/time/qdatetime.cpp index 189c474bfd..2bb925c60b 100644 --- a/src/corelib/time/qdatetime.cpp +++ b/src/corelib/time/qdatetime.cpp @@ -2980,7 +2980,7 @@ inline QDateTime::Data::Data(Qt::TimeSpec spec) } } -inline QDateTime::Data::Data(const Data &other) +inline QDateTime::Data::Data(const Data &other) noexcept : d(other.d) { if (!isShort()) { @@ -2997,7 +2997,7 @@ inline QDateTime::Data::Data(const Data &other) } } -inline QDateTime::Data::Data(Data &&other) +inline QDateTime::Data::Data(Data &&other) noexcept : d(other.d) { // reset the other to a short state @@ -3006,7 +3006,7 @@ inline QDateTime::Data::Data(Data &&other) other.d = dummy.d; } -inline QDateTime::Data &QDateTime::Data::operator=(const Data &other) +inline QDateTime::Data &QDateTime::Data::operator=(const Data &other) noexcept { if (d == other.d) return *this; diff --git a/src/corelib/time/qdatetime.h b/src/corelib/time/qdatetime.h index 79ae281774..08f0a1a533 100644 --- a/src/corelib/time/qdatetime.h +++ b/src/corelib/time/qdatetime.h @@ -286,9 +286,10 @@ class Q_CORE_EXPORT QDateTime Data() noexcept; Data(Qt::TimeSpec); - Data(const Data &other); - Data(Data &&other); - Data &operator=(const Data &other); + Data(const Data &other) noexcept; + Data(Data &&other) noexcept; + Data &operator=(const Data &other) noexcept; + Data &operator=(Data &&other) noexcept { swap(other); return *this; } ~Data(); void swap(Data &other) noexcept diff --git a/src/corelib/time/qtimezone.cpp b/src/corelib/time/qtimezone.cpp index 3b357cb455..c57e9e77fb 100644 --- a/src/corelib/time/qtimezone.cpp +++ b/src/corelib/time/qtimezone.cpp @@ -386,6 +386,15 @@ QTimeZone::QTimeZone(const QTimeZone &other) { } +/*! + Move constructor of this from \a other. +*/ + +QTimeZone::QTimeZone(QTimeZone &&other) noexcept + : d(std::move(other.d)) +{ +} + /*! Destroys the time zone. */ diff --git a/src/corelib/time/qtimezone.h b/src/corelib/time/qtimezone.h index b43f1f2af2..825caf1740 100644 --- a/src/corelib/time/qtimezone.h +++ b/src/corelib/time/qtimezone.h @@ -62,6 +62,7 @@ public: const QString &abbreviation, QLocale::Territory territory = QLocale::AnyTerritory, const QString &comment = QString()); QTimeZone(const QTimeZone &other); + QTimeZone(QTimeZone &&other) noexcept; ~QTimeZone(); QTimeZone &operator=(const QTimeZone &other);