Details
-
Bug
-
Resolution: Fixed
-
P1: Critical
-
6.9
-
None
-
Fedora 41, KDE Plasma
-
8f958a6e2 (dev), 1596b5855 (6.9)
Description
The following code fails to build with Qt 6.9 (but works with Qt 6.8 and earlier
#include <QString> #include <QVariant> #include <unordered_map> class Person { }; int main(){ std::unordered_map<QString, Person> container; QVariant::fromValue(container); }
Error message
[1/2] Building CXX object CMakeFiles/foo.dir/main.cpp.o FAILED: CMakeFiles/foo.dir/main.cpp.o /usr/lib64/ccache/c++ -DQT_CORE_LIB -DQT_NO_DEBUG -isystem /home/nico/workspace/maptets/build/foo_autogen/include -isystem /home/nico/kde/usr/include/QtCore -isystem /home/nico/kde/usr/include -isystem /home/nico/kde/usr/mkspecs/linux-g++ -isystem /home/nico/kde/usr/include/KF6/KTextTemplate -fPIC -MD -MT CMakeFiles/foo.dir/main.cpp.o -MF CMakeFiles/foo.dir/main.cpp.o.d -o CMakeFiles/foo.dir/main.cpp.o -c /home/nico/workspace/maptets/main.cpp In file included from /home/nico/kde/usr/include/QtCore/qvariant.h:12, from /home/nico/kde/usr/include/QtCore/QVariant:1, from /home/nico/workspace/maptets/main.cpp:2: /home/nico/kde/usr/include/QtCore/qdebug.h: In instantiation of 'QDebug QtPrivate::printSequentialContainer(QDebug, const char*, const SequentialContainer&) [with SequentialContainer = std::unordered_map<QString, Person>]': /home/nico/kde/usr/include/QtCore/qdebug.h:457:47: required from 'QDebug operator<<(QDebug, const std::unordered_map<_Key1, _Tp1, _Hash1, _Pred1, _Alloc1>&) [with Key = QString; T = Person; Hash = std::hash<QString>; KeyEqual = std::equal_to<QString>; Alloc = std::allocator<std::pair<const QString, Person> >]' 457 | return QtPrivate::printSequentialContainer(std::move(debug), "std::unordered_map", unordered_map); // yes, sequential: *it is std::pair | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /home/nico/kde/usr/include/QtCore/qmetatype.h:2362:11: required from 'static void QtPrivate::QDebugStreamOperatorForType<T, <anonymous> >::debugStream(const QtPrivate::QMetaTypeInterface*, QDebug&, const void*) [with T = std::unordered_map<QString, Person>; bool <anonymous> = true]' 2362 | { dbg << *reinterpret_cast<const T *>(a); } | ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /home/nico/kde/usr/include/QtCore/qmetatype.h:2522:33: required from 'QtPrivate::QMetaTypeInterfaceWrapper<std::unordered_map<QString, Person> >::InterfaceType QtPrivate::QMetaTypeInterfaceWrapper<std::unordered_map<QString, Person> >::metaType' 2522 | static inline InterfaceType metaType = { | ^~~~~~~~ /home/nico/kde/usr/include/QtCore/qmetatype.h:2625:12: required from 'constexpr const QtPrivate::QMetaTypeInterface* QtPrivate::qMetaTypeInterfaceForType() [with T = std::unordered_map<QString, Person>]' 2625 | return &QMetaTypeInterfaceWrapper<Ty>::metaType; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /home/nico/kde/usr/include/QtCore/qmetatype.h:2661:61: required from 'static constexpr QMetaType QMetaType::fromType() [with T = std::unordered_map<QString, Person>]' 2661 | return QMetaType(QtPrivate::qMetaTypeInterfaceForType<T>()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~ /home/nico/kde/usr/include/QtCore/qvariant.h:579:47: required from 'static std::enable_if_t<((bool)(is_copy_constructible_v<T> && is_destructible_v<T>)), QVariant> QVariant::fromValue(const T&) [with T = std::unordered_map<QString, Person>; std::enable_if_t<((bool)(is_copy_constructible_v<T> && is_destructible_v<T>)), QVariant> = QVariant]' 579 | return QVariant(QMetaType::fromType<T>(), std::addressof(value)); | ~~~~~~~~~~~~~~~~~~~~~~^~ /home/nico/workspace/maptets/main.cpp:12:24: required from here 12 | QVariant::fromValue(container); | ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~ /home/nico/kde/usr/include/QtCore/qdebug.h:358:15: error: no match for 'operator<<' (operand types are 'QDebug' and 'const std::__detail::_Node_const_iterator<std::pair<const QString, Person>, false, false>::value_type' {aka 'const std::pair<const QString, Person>'}) 358 | debug << *it; | ~~~~~~^~~~~~
(error message goes on listing all operator<< overloads for QDebug)
Attachments
Issue Links
- is duplicated by
-
QTBUG-132515 Signal requires debug output operator
-
- Closed
-
- resulted from
-
QTBUG-130290 QDebug - Does not Support for UnOrderedMap
-
- Closed
-