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 Change-Id: Ic6547f8247454b47baa8fffd170eef346b7f4f24 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> (cherry picked from commit f039147165049dedcf6e1d92d902af28f566d753) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
e3de89533b
commit
8226ae9ac7
@ -422,7 +422,12 @@ void tst_QMap::beginEnd()
|
|||||||
// detach
|
// detach
|
||||||
map2.insert( "2", "c" );
|
map2.insert( "2", "c" );
|
||||||
QVERIFY( map.constBegin() == map.constBegin() );
|
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()
|
void tst_QMap::firstLast()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user