Details
-
Bug
-
Resolution: Fixed
-
P1: Critical
-
6.7.1
-
None
-
669f7e3b9723446732d31d48b653cd2bd9580f2d (qtbase/dev), dcc482cd01c138e4603a349986f5419b03583c96(qtbase/6.7)
Description
If you compile Qt 6.7.1 with Clang 18 in C++20 mode, you will see the following compilation error:
In file included from /somewhere/qt-everywhere-src-6.7.1/qtbase/src/corelib/compat/removed_api.cpp:287: In file included from /somewhere/qt-build/qtbase/include/QtCore/qdir.h:1: In file included from /somewhere/qt-everywhere-src-6.7.1/qtbase/src/corelib/io/qdir.h:9: In file included from /somewhere/qt-build/qtbase/include/QtCore/qfileinfo.h:1: In file included from /somewhere/qt-everywhere-src-6.7.1/qtbase/src/corelib/io/qfileinfo.h:11: In file included from /somewhere/qt-build/qtbase/include/QtCore/qdatetime.h:1: /somewhere/qt-everywhere-src-6.7.1/qtbase/src/corelib/time/qdatetime.h:532:19: error: call to constructor of 'QDateTime' is ambiguous 532 | QDateTime result(QDate(1970, 1, 1), QTime(0, 0, 0)); | ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /somewhere/qt-everywhere-src-6.7.1/qtbase/src/corelib/time/qdatetime.h:359:5: note: candidate constructor 359 | QDateTime(QDate date, QTime time); | ^ /somewhere/qt-everywhere-src-6.7.1/qtbase/src/corelib/time/qdatetime.h:363:5: note: candidate constructor 363 | QDateTime(QDate date, QTime time, | ^ 1 error generated.
This is because qtbase/src/corelib/compat/removed_api.cpp defines QT_CORE_BUILD_REMOVED_API, which results in the following code after preprocessing:
QDateTime(QDate date, QTime time); QDateTime(QDate date, QTime time, TransitionResolution resolve = TransitionResolution::LegacyBehavior);
It compiles with GCC only by chance because GCC is less thorough in checking code inside the templated function fromStdLocalTime:
template <typename = void> static QDateTime fromStdLocalTime(const std::chrono::local_time<std::chrono::milliseconds> &time) { QDateTime result(QDate(1970, 1, 1), QTime(0, 0, 0)); return result.addMSecs(time.time_since_epoch().count()); }
This godbolt fragment demonstrates the problem: https://godbolt.org/z/4f3x7zo9j
Attachments
Issue Links
- duplicates
-
QTBUG-125079 removed_api.cpp compile error
-
- Closed
-