From 259dee218e9ec9f32ae86771f7dd61466aa8bd74 Mon Sep 17 00:00:00 2001 From: Eirik Aavitsland Date: Mon, 19 Apr 2021 09:30:18 +0200 Subject: [PATCH] Fix another compilation error in QDateTime Similar fix as 538e9fa5689a1afe0d821b84cdfeaa1656973083 : gcc 7.5, used e.g. on Jetson, is not able to resolve the add_overflow overload without help. Change-Id: I4d497480bb8dc82d7b1cbd13fda8e291935c8752 Reviewed-by: Andrei Golubev Reviewed-by: Thiago Macieira --- src/corelib/time/qdatetime.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/corelib/time/qdatetime.cpp b/src/corelib/time/qdatetime.cpp index 28816ccef6..d61bd3a69b 100644 --- a/src/corelib/time/qdatetime.cpp +++ b/src/corelib/time/qdatetime.cpp @@ -2663,7 +2663,9 @@ bool QDateTimePrivate::epochMSecsToLocalTime(qint64 msecs, QDate *localDate, QTi : QDateTimePrivate::StandardTime; } - if (add_overflow(msecs, sys.d->offsetFromUtc(msecs) * 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(sys.d->offsetFromUtc(msecs) * MSECS_PER_SEC), &msecs)) return false; msecsToTime(msecs, localDate, localTime); return true;