Fix compilation error in QDateTime

One of the changes done in 902505a058
results in a compilation error: somehow an expression
"int * enum value (with underlying type qint64)" has result type
"long int" and thus the compiler cannot find matching add_overflow

Return the qint64 cast back to overcome this
Compiler: gcc 7.5.0-3ubuntu1~18.04

Change-Id: Iaca882762e812bef69ec325df5f59e02082a0130
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
bb10
Andrei Golubev 2021-03-03 11:59:04 +01:00
parent 712117f8b8
commit 538e9fa568
1 changed files with 3 additions and 1 deletions

View File

@ -3933,7 +3933,9 @@ void QDateTime::setMSecsSinceEpoch(qint64 msecs)
status = mergeDaylightStatus(status, QDateTimePrivate::StandardTime);
d->m_offsetFromUtc = d->m_timeZone.d->standardTimeOffset(msecs);
}
if (!add_overflow(msecs, d->m_offsetFromUtc * MSECS_PER_SEC, &msecs))
// NB: cast to qint64 here is important to make sure a matching
// add_overflow is found, GCC 7.5.0 fails without this cast
if (!add_overflow(msecs, qint64(d->m_offsetFromUtc * MSECS_PER_SEC), &msecs))
status |= QDateTimePrivate::ValidWhenMask;
#endif // timezone
break;