summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/tools/qmap/tst_qmap.cpp
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2022-08-26 12:38:40 -0300
committerThiago Macieira <thiago.macieira@intel.com>2022-08-28 11:04:14 -0300
commitf039147165049dedcf6e1d92d902af28f566d753 (patch)
treebd399c2ab5f6b693c78d9c9f3ae4d21e177e59b1 /tests/auto/corelib/tools/qmap/tst_qmap.cpp
parentdfc82f7917e895b2cd9bd3c9352b4802a69371f6 (diff)
tst_QMap: avoid tripping MSVC debug-mode iterator assertions
It does a check to ensure you aren't comparing outside the container. Fixes: QTBUG-106001 Pick-to: 6.2 6.3 6.4 Change-Id: Ic6547f8247454b47baa8fffd170eef346b7f4f24 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Diffstat (limited to 'tests/auto/corelib/tools/qmap/tst_qmap.cpp')
-rw-r--r--tests/auto/corelib/tools/qmap/tst_qmap.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/auto/corelib/tools/qmap/tst_qmap.cpp b/tests/auto/corelib/tools/qmap/tst_qmap.cpp
index 554366ce3d..d4f886784d 100644
--- a/tests/auto/corelib/tools/qmap/tst_qmap.cpp
+++ b/tests/auto/corelib/tools/qmap/tst_qmap.cpp
@@ -429,7 +429,12 @@ void tst_QMap::beginEnd()
// detach
map2.insert( "2", "c" );
QVERIFY( map.constBegin() == map.constBegin() );
- QVERIFY( map.constBegin() != map2.constBegin() );
+
+ // comparing iterators between two different std::map is UB (and raises an
+ // assertion failure with MSVC debug-mode iterators), so we compare the
+ // elements' addresses.
+ QVERIFY(&map.constBegin().key() != &map2.constBegin().key());
+ QVERIFY(&map.constBegin().value() != &map2.constBegin().value());
}
void tst_QMap::firstLast()