diff options
author | Andrei Golubev <andrei.golubev@qt.io> | 2021-03-03 11:59:04 +0100 |
---|---|---|
committer | Andrei Golubev <andrei.golubev@qt.io> | 2021-03-04 08:26:30 +0100 |
commit | 538e9fa5689a1afe0d821b84cdfeaa1656973083 (patch) | |
tree | f9c6cd958846f681166d6f627c5d10e970b00d35 /src/corelib/time | |
parent | 712117f8b89cdb2578d6aaa424141da216799fe9 (diff) |
Fix compilation error in QDateTime
One of the changes done in 902505a0584959fed9d0784ab5308f9d70fe68a9
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>
Diffstat (limited to 'src/corelib/time')
-rw-r--r-- | src/corelib/time/qdatetime.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/corelib/time/qdatetime.cpp b/src/corelib/time/qdatetime.cpp index 26e25afd38..979ec12ff0 100644 --- a/src/corelib/time/qdatetime.cpp +++ b/src/corelib/time/qdatetime.cpp @@ -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; |