Details
-
Bug
-
Resolution: Fixed
-
P5: Not important
-
6.6.2
-
None
-
-
5401a9a6c (dev), 9ffed81b1 (6.7), 1e11f8fa8 (6.6), bb3d6f96a (tqtc/lts-6.5)
Description
The following code fails to compile:
QMap<QString, std::pair<int, int>> map {}; QDBusArgument arg; arg << map;
because the call to to operator<< is ambiguous (two possible calls in qdbusargument.h):
template <template <typename, typename> class Container, typename Key, typename T, QtPrivate::IfAssociativeIteratorHasKeyAndValue<typename Container<Key, T>::iterator> = true> inline QDBusArgument &operator<<(QDBusArgument &arg, const Container<Key, T> &map);
and
template <template <typename, typename> class Container, typename Key, typename T, QtPrivate::IfAssociativeIteratorHasFirstAndSecond<typename Container<Key, T>::iterator> = true> inline QDBusArgument &operator<<(QDBusArgument &arg, const Container<Key, T> &map);
The iterator type of the map has both, key()/value() methods from the map itself and first/second access through operator-> of the map.Hence, both functions match. Obviously, the first one should be the correct one to call in this case.
Is this the expected behavior?