Details
-
Bug
-
Resolution: Invalid
-
Not Evaluated
-
None
-
6.2.0 Alpha
-
None
Description
using TestMultiMap = QMultiMap<int, QByteArray>; void test(TestMultiMap m) { for (auto it = m.cbegin(), end = m.cend(); it != end; ) { const auto &key = it.key(); TestMultiMap::const_iterator keyEnd = m.upperBound(key); const auto count = std::distance(it, keyEnd); qDebug() << it.key() << "count=" << count; for ( ; it != keyEnd; ++it) qDebug() << it.key() << it.value(); } }
produces a hang in std::distance() with g++ 9.3.0.1 and a "mismatched set/hash" iterator error with MSVC (5.15: crash). When changing the function to take a (const TestMultiMap &m), the code works as expected.
It is weird since TestMultiMap::const_iterator keyEnd = m.upperBound(key) should produce a proper const iterator.