Details
-
Bug
-
Resolution: Done
-
P2: Important
-
6.2.6, 6.4.0
-
Windows 10 Pro 21H2, MSVC 2019
-
fb4bc5fa26 (qt/qtbase/dev) fb4bc5fa26 (qt/tqtc-qtbase/dev), b2f3af4db (6.4)
Description
See attached project.
Code
// SetLib.h, part of DLL namespace NS { enum MyEnum { Alpha, Bravo, Charlie }; QSet<MyEnum> QSETLIB_EXPORT getSet(); // Exported by library inline QSet<MyEnum> getSetInline() { return QSet<MyEnum>{Alpha}; } // NOT exported by library }
// SetLib.cpp, part of DLL #include <QKeySequence> #include "QSetLib.h" QSet<NS::MyEnum> NS::getSet() { return QSet<MyEnum>{Alpha}; }
// main.cpp, in app that loads DLL #include "QSetLib.h" #include <QDebug> int main() { auto set1 = NS::getSet(); auto set2 = NS::getSetInline(); qDebug() << "Set contents are equal?" << (set1.values() == set2.values()); qDebug() << "Sets are equal?" << (set1 == set2); }
Qt 5.15.11 output (Correct)
Set contents are equal? true Sets are equal? true
Qt 6.2.6/6.4.0 output (Wrong)
Set contents are equal? true Sets are equal? false
Notes
You can replace #include <QKeySequence> with the following and still trigger the error:
struct Conflictor { Conflictor(int); }; size_t qHash(const Conflictor &key, size_t seed = 0) noexcept;
Workarounds
- Make sure that <QSet> is included before <QKeySequence>, OR
- Convert the enum to an enum class, to prevent implicit conversion to int
Attachments
Issue Links
- resulted in
-
QTBUG-106219 [macOS] Typing accented/alternate characters doesn't work correctly
-
- Closed
-