[PATCH] D53793: [ADT] Remove illegal comparison of singular iterators from SmallSetTest
Eugene Sharygin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Oct 27 03:55:57 PDT 2018
eush created this revision.
eush added reviewers: fhahn, dblaikie, chandlerc.
Herald added a subscriber: dexonsmith.
This removes the assertion that a copy of a moved-from SmallSetIterator
equals the original, which is illegal due to SmallSetIterator including
an instance of a standard `std::set` iterator.
C++ [iterator.requirements.general] states that comparing singular
iterators has undefined result:
Iterators can also have singular values that are not associated with
any sequence. [...] Results of most expressions are undefined for
singular values; the only exceptions are destroying an iterator that
holds a singular value, the assignment of a non-singular value to an
iterator that holds a singular value, and, for iterators that satisfy
the Cpp17DefaultConstructible requirements, using a value-initialized
iterator as the source of a copy or move operation.
This assertion triggers the following error in the GNU C++ Library in
debug mode under EXPENSIVE_CHECKS:
/usr/include/c++/8.2.1/debug/safe_iterator.h:518:
Error: attempt to compare a singular iterator to a singular iterator.
Objects involved in the operation:
iterator "lhs" @ 0x0x7fff86420670 {
state = singular;
}
iterator "rhs" @ 0x0x7fff86420640 {
state = singular;
}
Repository:
rL LLVM
https://reviews.llvm.org/D53793
Files:
unittests/ADT/SmallSetTest.cpp
Index: unittests/ADT/SmallSetTest.cpp
===================================================================
--- unittests/ADT/SmallSetTest.cpp
+++ unittests/ADT/SmallSetTest.cpp
@@ -142,8 +142,4 @@
auto Iter2 = s1.begin();
Iter = std::move(Iter2);
EXPECT_EQ("str 0", *Iter);
-
- auto Iter3 = s1.end();
- Iter3 = Iter2;
- EXPECT_EQ(Iter3, Iter2);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53793.171395.patch
Type: text/x-patch
Size: 359 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181027/7dcb0e97/attachment.bin>
More information about the llvm-commits
mailing list