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>
This commit is contained in:
Edward Welbourne 2020-09-14 15:15:43 +02:00
parent e4f647e272
commit e33b0d4bb0
2 changed files with 7 additions and 6 deletions

View File

@ -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
{
}

View File

@ -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);