diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2020-09-14 15:15:43 +0200 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2020-09-23 17:16:48 +0200 |
commit | e33b0d4bb068873ed54116a540f9a498172d1a79 (patch) | |
tree | 6725e91229ed0d33d1b563675221fadcf6f9b956 | |
parent | e4f647e2720612d030e4a2240a00500054bbda99 (diff) |
Make QDateTime() unconditionally noexcept
As proposed by Lars in code-review; its Data::Data() is in fact
noexcept even when CanBeSmall is false.
Task-number: QTBUG-86400
Change-Id: I351e4332660f5895fff34b950227cbb811fd9f81
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
-rw-r--r-- | src/corelib/time/qdatetime.cpp | 9 | ||||
-rw-r--r-- | src/corelib/time/qdatetime.h | 4 |
2 files changed, 7 insertions, 6 deletions
diff --git a/src/corelib/time/qdatetime.cpp b/src/corelib/time/qdatetime.cpp index af77a0ee26..05f0f37ee8 100644 --- a/src/corelib/time/qdatetime.cpp +++ b/src/corelib/time/qdatetime.cpp @@ -2984,7 +2984,7 @@ static QPair<QDate, QTime> getDateTime(const QDateTimeData &d) QDateTime::Data member functions *****************************************************************************/ -inline QDateTime::Data::Data() +inline QDateTime::Data::Data() noexcept { // default-constructed data has a special exception: // it can be small even if CanBeSmall == false @@ -3327,12 +3327,13 @@ inline qint64 QDateTimePrivate::zoneMSecsToEpochMSecs(qint64 zoneMSecs, const QT */ /*! - Constructs a null datetime (i.e. null date and null time). A null - datetime is invalid, since the date is invalid. + Constructs a null datetime. + + A null datetime is invalid, since its date and time are invalid. \sa isValid() */ -QDateTime::QDateTime() noexcept(Data::CanBeSmall) +QDateTime::QDateTime() noexcept { } diff --git a/src/corelib/time/qdatetime.h b/src/corelib/time/qdatetime.h index f35da36e30..4556895f10 100644 --- a/src/corelib/time/qdatetime.h +++ b/src/corelib/time/qdatetime.h @@ -244,7 +244,7 @@ class Q_CORE_EXPORT QDateTime CanBeSmall = sizeof(ShortData) * 8 > 50 }; - Data(); + Data() noexcept; Data(Qt::TimeSpec); Data(const Data &other); Data(Data &&other); @@ -262,7 +262,7 @@ class Q_CORE_EXPORT QDateTime }; public: - QDateTime() noexcept(Data::CanBeSmall); + QDateTime() noexcept; QDateTime(QDate date, QTime time, Qt::TimeSpec spec = Qt::LocalTime, int offsetSeconds = 0); #if QT_CONFIG(timezone) QDateTime(QDate date, QTime time, const QTimeZone &timeZone); |