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?
Attachments
For Gerrit Dashboard: QTBUG-123401 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
548439,3 | QDBusArgument: disambiguate between QMap on std::pair and std::map | dev | qt/qtbase | Status: MERGED | +2 | 0 |
549000,2 | QDBusArgument: disambiguate between QMap on std::pair and std::map | 6.7 | qt/qtbase | Status: MERGED | +2 | 0 |
549114,2 | QDBusArgument: disambiguate between QMap on std::pair and std::map | 6.6 | qt/qtbase | Status: MERGED | +2 | 0 |
549418,2 | QDBusArgument: disambiguate between QMap on std::pair and std::map | tqtc/lts-6.5 | qt/tqtc-qtbase | Status: MERGED | +2 | 0 |