aboutsummaryrefslogtreecommitdiff
path: root/libcxx
diff options
context:
space:
mode:
authorDavid Benjamin <davidben@google.com>2024-03-11 21:39:21 -0400
committerGitHub <noreply@github.com>2024-03-11 18:39:21 -0700
commit41658bafb70680d0aafb7e79c7f694b8c2a5217d (patch)
tree666dd972bec6bbb8c04648e84f9c4df1b5405480 /libcxx
parent672fc89347b831f2845e7825affc30c865758270 (diff)
downloadllvm-41658bafb70680d0aafb7e79c7f694b8c2a5217d.zip
llvm-41658bafb70680d0aafb7e79c7f694b8c2a5217d.tar.gz
llvm-41658bafb70680d0aafb7e79c7f694b8c2a5217d.tar.bz2
[libc++][hardening] Add iterator validity checks on unordered containers (#80230)
These are simply null checks, so use `_LIBCPP_ASSERT_NON_NULL`. This allows us to restore a bunch of the old debug tests. I've extended them to also cover the const iterators, as those run through different codepaths than the const ones. This does the easier (and less important) half of #80212.
Diffstat (limited to 'libcxx')
-rw-r--r--libcxx/include/__hash_table40
-rw-r--r--libcxx/test/libcxx/containers/unord/unord.map/assert.iterator.dereference.pass.cpp52
-rw-r--r--libcxx/test/libcxx/containers/unord/unord.map/assert.iterator.increment.pass.cpp59
-rw-r--r--libcxx/test/libcxx/containers/unord/unord.map/assert.local_iterator.dereference.pass.cpp50
-rw-r--r--libcxx/test/libcxx/containers/unord/unord.map/assert.local_iterator.increment.pass.cpp66
-rw-r--r--libcxx/test/libcxx/containers/unord/unord.map/debug.iterator.dereference.pass.cpp41
-rw-r--r--libcxx/test/libcxx/containers/unord/unord.map/debug.iterator.increment.pass.cpp46
-rw-r--r--libcxx/test/libcxx/containers/unord/unord.map/debug.local_iterator.dereference.pass.cpp39
-rw-r--r--libcxx/test/libcxx/containers/unord/unord.map/debug.local_iterator.increment.pass.cpp49
-rw-r--r--libcxx/test/libcxx/containers/unord/unord.multimap/assert.iterator.dereference.pass.cpp52
-rw-r--r--libcxx/test/libcxx/containers/unord/unord.multimap/assert.iterator.increment.pass.cpp59
-rw-r--r--libcxx/test/libcxx/containers/unord/unord.multimap/assert.local_iterator.dereference.pass.cpp50
-rw-r--r--libcxx/test/libcxx/containers/unord/unord.multimap/assert.local_iterator.increment.pass.cpp67
-rw-r--r--libcxx/test/libcxx/containers/unord/unord.multimap/debug.iterator.dereference.pass.cpp41
-rw-r--r--libcxx/test/libcxx/containers/unord/unord.multimap/debug.iterator.increment.pass.cpp46
-rw-r--r--libcxx/test/libcxx/containers/unord/unord.multimap/debug.local_iterator.dereference.pass.cpp39
-rw-r--r--libcxx/test/libcxx/containers/unord/unord.multimap/debug.local_iterator.increment.pass.cpp50
-rw-r--r--libcxx/test/libcxx/containers/unord/unord.multiset/assert.iterator.dereference.pass.cpp46
-rw-r--r--libcxx/test/libcxx/containers/unord/unord.multiset/assert.iterator.increment.pass.cpp58
-rw-r--r--libcxx/test/libcxx/containers/unord/unord.multiset/assert.local_iterator.dereference.pass.cpp48
-rw-r--r--libcxx/test/libcxx/containers/unord/unord.multiset/assert.local_iterator.increment.pass.cpp64
-rw-r--r--libcxx/test/libcxx/containers/unord/unord.multiset/debug.iterator.dereference.pass.cpp39
-rw-r--r--libcxx/test/libcxx/containers/unord/unord.multiset/debug.iterator.increment.pass.cpp47
-rw-r--r--libcxx/test/libcxx/containers/unord/unord.multiset/debug.local_iterator.dereference.pass.cpp41
-rw-r--r--libcxx/test/libcxx/containers/unord/unord.multiset/debug.local_iterator.increment.pass.cpp51
-rw-r--r--libcxx/test/libcxx/containers/unord/unord.set/assert.iterator.dereference.pass.cpp46
-rw-r--r--libcxx/test/libcxx/containers/unord/unord.set/assert.iterator.increment.pass.cpp58
-rw-r--r--libcxx/test/libcxx/containers/unord/unord.set/assert.local_iterator.dereference.pass.cpp48
-rw-r--r--libcxx/test/libcxx/containers/unord/unord.set/assert.local_iterator.increment.pass.cpp64
-rw-r--r--libcxx/test/libcxx/containers/unord/unord.set/debug.iterator.dereference.pass.cpp39
-rw-r--r--libcxx/test/libcxx/containers/unord/unord.set/debug.iterator.increment.pass.cpp47
-rw-r--r--libcxx/test/libcxx/containers/unord/unord.set/debug.local_iterator.dereference.pass.cpp41
-rw-r--r--libcxx/test/libcxx/containers/unord/unord.set/debug.local_iterator.increment.pass.cpp49
33 files changed, 923 insertions, 709 deletions
diff --git a/libcxx/include/__hash_table b/libcxx/include/__hash_table
index ec7d694..e6691e7 100644
--- a/libcxx/include/__hash_table
+++ b/libcxx/include/__hash_table
@@ -284,13 +284,21 @@ public:
_LIBCPP_HIDE_FROM_ABI __hash_iterator() _NOEXCEPT : __node_(nullptr) {}
- _LIBCPP_HIDE_FROM_ABI reference operator*() const { return __node_->__upcast()->__get_value(); }
+ _LIBCPP_HIDE_FROM_ABI reference operator*() const {
+ _LIBCPP_ASSERT_NON_NULL(
+ __node_ != nullptr, "Attempted to dereference a non-dereferenceable unordered container iterator");
+ return __node_->__upcast()->__get_value();
+ }
_LIBCPP_HIDE_FROM_ABI pointer operator->() const {
+ _LIBCPP_ASSERT_NON_NULL(
+ __node_ != nullptr, "Attempted to dereference a non-dereferenceable unordered container iterator");
return pointer_traits<pointer>::pointer_to(__node_->__upcast()->__get_value());
}
_LIBCPP_HIDE_FROM_ABI __hash_iterator& operator++() {
+ _LIBCPP_ASSERT_NON_NULL(
+ __node_ != nullptr, "Attempted to increment a non-incrementable unordered container iterator");
__node_ = __node_->__next_;
return *this;
}
@@ -345,12 +353,20 @@ public:
_LIBCPP_HIDE_FROM_ABI __hash_const_iterator(const __non_const_iterator& __x) _NOEXCEPT : __node_(__x.__node_) {}
- _LIBCPP_HIDE_FROM_ABI reference operator*() const { return __node_->__upcast()->__get_value(); }
+ _LIBCPP_HIDE_FROM_ABI reference operator*() const {
+ _LIBCPP_ASSERT_NON_NULL(
+ __node_ != nullptr, "Attempted to dereference a non-dereferenceable unordered container const_iterator");
+ return __node_->__upcast()->__get_value();
+ }
_LIBCPP_HIDE_FROM_ABI pointer operator->() const {
+ _LIBCPP_ASSERT_NON_NULL(
+ __node_ != nullptr, "Attempted to dereference a non-dereferenceable unordered container const_iterator");
return pointer_traits<pointer>::pointer_to(__node_->__upcast()->__get_value());
}
_LIBCPP_HIDE_FROM_ABI __hash_const_iterator& operator++() {
+ _LIBCPP_ASSERT_NON_NULL(
+ __node_ != nullptr, "Attempted to increment a non-incrementable unordered container const_iterator");
__node_ = __node_->__next_;
return *this;
}
@@ -400,13 +416,21 @@ public:
_LIBCPP_HIDE_FROM_ABI __hash_local_iterator() _NOEXCEPT : __node_(nullptr) {}
- _LIBCPP_HIDE_FROM_ABI reference operator*() const { return __node_->__upcast()->__get_value(); }
+ _LIBCPP_HIDE_FROM_ABI reference operator*() const {
+ _LIBCPP_ASSERT_NON_NULL(
+ __node_ != nullptr, "Attempted to dereference a non-dereferenceable unordered container local_iterator");
+ return __node_->__upcast()->__get_value();
+ }
_LIBCPP_HIDE_FROM_ABI pointer operator->() const {
+ _LIBCPP_ASSERT_NON_NULL(
+ __node_ != nullptr, "Attempted to dereference a non-dereferenceable unordered container local_iterator");
return pointer_traits<pointer>::pointer_to(__node_->__upcast()->__get_value());
}
_LIBCPP_HIDE_FROM_ABI __hash_local_iterator& operator++() {
+ _LIBCPP_ASSERT_NON_NULL(
+ __node_ != nullptr, "Attempted to increment a non-incrementable unordered container local_iterator");
__node_ = __node_->__next_;
if (__node_ != nullptr && std::__constrain_hash(__node_->__hash(), __bucket_count_) != __bucket_)
__node_ = nullptr;
@@ -475,13 +499,21 @@ public:
__bucket_(__x.__bucket_),
__bucket_count_(__x.__bucket_count_) {}
- _LIBCPP_HIDE_FROM_ABI reference operator*() const { return __node_->__upcast()->__get_value(); }
+ _LIBCPP_HIDE_FROM_ABI reference operator*() const {
+ _LIBCPP_ASSERT_NON_NULL(
+ __node_ != nullptr, "Attempted to dereference a non-dereferenceable unordered container const_local_iterator");
+ return __node_->__upcast()->__get_value();
+ }
_LIBCPP_HIDE_FROM_ABI pointer operator->() const {
+ _LIBCPP_ASSERT_NON_NULL(
+ __node_ != nullptr, "Attempted to dereference a non-dereferenceable unordered container const_local_iterator");
return pointer_traits<pointer>::pointer_to(__node_->__upcast()->__get_value());
}
_LIBCPP_HIDE_FROM_ABI __hash_const_local_iterator& operator++() {
+ _LIBCPP_ASSERT_NON_NULL(
+ __node_ != nullptr, "Attempted to increment a non-incrementable unordered container const_local_iterator");
__node_ = __node_->__next_;
if (__node_ != nullptr && std::__constrain_hash(__node_->__hash(), __bucket_count_) != __bucket_)
__node_ = nullptr;
diff --git a/libcxx/test/libcxx/containers/unord/unord.map/assert.iterator.dereference.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.map/assert.iterator.dereference.pass.cpp
new file mode 100644
index 0000000..f57341d
--- /dev/null
+++ b/libcxx/test/libcxx/containers/unord/unord.map/assert.iterator.dereference.pass.cpp
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_map>
+
+// Dereference non-dereferenceable iterator.
+
+// REQUIRES: has-unix-headers, libcpp-hardening-mode={{extensive|debug}}
+// UNSUPPORTED: c++03
+// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing
+
+#include <unordered_map>
+#include <string>
+
+#include "check_assertion.h"
+#include "min_allocator.h"
+
+int main(int, char**) {
+ {
+ typedef std::unordered_map<int, std::string> C;
+ C c;
+ c.insert(std::make_pair(1, "one"));
+ C::iterator i = c.end();
+ TEST_LIBCPP_ASSERT_FAILURE(*i, "Attempted to dereference a non-dereferenceable unordered container iterator");
+ C::const_iterator i2 = c.cend();
+ TEST_LIBCPP_ASSERT_FAILURE(
+ *i2, "Attempted to dereference a non-dereferenceable unordered container const_iterator");
+ }
+
+ {
+ typedef std::unordered_map<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ C c;
+ c.insert(std::make_pair(1, "one"));
+ C::iterator i = c.end();
+ TEST_LIBCPP_ASSERT_FAILURE(*i, "Attempted to dereference a non-dereferenceable unordered container iterator");
+ C::const_iterator i2 = c.cend();
+ TEST_LIBCPP_ASSERT_FAILURE(
+ *i2, "Attempted to dereference a non-dereferenceable unordered container const_iterator");
+ }
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx/containers/unord/unord.map/assert.iterator.increment.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.map/assert.iterator.increment.pass.cpp
new file mode 100644
index 0000000..3f4d1c2
--- /dev/null
+++ b/libcxx/test/libcxx/containers/unord/unord.map/assert.iterator.increment.pass.cpp
@@ -0,0 +1,59 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_map>
+
+// Increment iterator past end.
+
+// REQUIRES: has-unix-headers, libcpp-hardening-mode={{extensive|debug}}
+// UNSUPPORTED: c++03
+// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing
+
+#include <unordered_map>
+#include <cassert>
+#include <string>
+
+#include "check_assertion.h"
+#include "min_allocator.h"
+
+int main(int, char**) {
+ {
+ typedef std::unordered_map<int, std::string> C;
+ C c;
+ c.insert(std::make_pair(1, "one"));
+ C::iterator i = c.begin();
+ ++i;
+ assert(i == c.end());
+ TEST_LIBCPP_ASSERT_FAILURE(++i, "Attempted to increment a non-incrementable unordered container iterator");
+ C::const_iterator i2 = c.cbegin();
+ ++i2;
+ assert(i2 == c.cend());
+ TEST_LIBCPP_ASSERT_FAILURE(++i2, "Attempted to increment a non-incrementable unordered container const_iterator");
+ }
+
+ {
+ typedef std::unordered_map<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ C c;
+ c.insert(std::make_pair(1, "one"));
+ C::iterator i = c.begin();
+ ++i;
+ assert(i == c.end());
+ TEST_LIBCPP_ASSERT_FAILURE(++i, "Attempted to increment a non-incrementable unordered container iterator");
+ C::const_iterator i2 = c.cbegin();
+ ++i2;
+ assert(i2 == c.cend());
+ TEST_LIBCPP_ASSERT_FAILURE(++i2, "Attempted to increment a non-incrementable unordered container const_iterator");
+ }
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx/containers/unord/unord.map/assert.local_iterator.dereference.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.map/assert.local_iterator.dereference.pass.cpp
new file mode 100644
index 0000000..8b47f54
--- /dev/null
+++ b/libcxx/test/libcxx/containers/unord/unord.map/assert.local_iterator.dereference.pass.cpp
@@ -0,0 +1,50 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_map>
+
+// Dereference non-dereferenceable iterator.
+
+// REQUIRES: has-unix-headers, libcpp-hardening-mode={{extensive|debug}}
+// UNSUPPORTED: c++03
+// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing
+
+#include <unordered_map>
+#include <string>
+
+#include "check_assertion.h"
+#include "min_allocator.h"
+
+int main(int, char**) {
+ {
+ typedef std::unordered_map<int, std::string> C;
+ C c(1);
+ C::local_iterator i = c.end(0);
+ TEST_LIBCPP_ASSERT_FAILURE(*i, "Attempted to dereference a non-dereferenceable unordered container local_iterator");
+ C::const_local_iterator i2 = c.cend(0);
+ TEST_LIBCPP_ASSERT_FAILURE(
+ *i2, "Attempted to dereference a non-dereferenceable unordered container const_local_iterator");
+ }
+
+ {
+ typedef std::unordered_map<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ C c(1);
+ C::local_iterator i = c.end(0);
+ TEST_LIBCPP_ASSERT_FAILURE(*i, "Attempted to dereference a non-dereferenceable unordered container local_iterator");
+ C::const_local_iterator i2 = c.cend(0);
+ TEST_LIBCPP_ASSERT_FAILURE(
+ *i2, "Attempted to dereference a non-dereferenceable unordered container const_local_iterator");
+ }
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx/containers/unord/unord.map/assert.local_iterator.increment.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.map/assert.local_iterator.increment.pass.cpp
new file mode 100644
index 0000000..8f83058
--- /dev/null
+++ b/libcxx/test/libcxx/containers/unord/unord.map/assert.local_iterator.increment.pass.cpp
@@ -0,0 +1,66 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_map>
+
+// Increment local_iterator past end.
+
+// REQUIRES: has-unix-headers, libcpp-hardening-mode={{extensive|debug}}
+// UNSUPPORTED: c++03
+// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing
+
+#include <unordered_map>
+#include <string>
+#include <cassert>
+
+#include "check_assertion.h"
+#include "min_allocator.h"
+
+int main(int, char**) {
+ {
+ typedef std::unordered_map<int, std::string> C;
+ C c;
+ c.insert(std::make_pair(42, std::string()));
+ C::size_type b = c.bucket(42);
+ C::local_iterator i = c.begin(b);
+ assert(i != c.end(b));
+ ++i;
+ assert(i == c.end(b));
+ TEST_LIBCPP_ASSERT_FAILURE(++i, "Attempted to increment a non-incrementable unordered container local_iterator");
+ C::const_local_iterator i2 = c.cbegin(b);
+ assert(i2 != c.cend(b));
+ ++i2;
+ assert(i2 == c.cend(b));
+ TEST_LIBCPP_ASSERT_FAILURE(
+ ++i2, "Attempted to increment a non-incrementable unordered container const_local_iterator");
+ }
+
+ {
+ typedef std::unordered_map<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ C c({{42, std::string()}});
+ C::size_type b = c.bucket(42);
+ C::local_iterator i = c.begin(b);
+ assert(i != c.end(b));
+ ++i;
+ assert(i == c.end(b));
+ TEST_LIBCPP_ASSERT_FAILURE(++i, "Attempted to increment a non-incrementable unordered container local_iterator");
+ C::const_local_iterator i2 = c.cbegin(b);
+ assert(i2 != c.cend(b));
+ ++i2;
+ assert(i2 == c.cend(b));
+ TEST_LIBCPP_ASSERT_FAILURE(
+ ++i2, "Attempted to increment a non-incrementable unordered container const_local_iterator");
+ }
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx/containers/unord/unord.map/debug.iterator.dereference.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.map/debug.iterator.dereference.pass.cpp
deleted file mode 100644
index 5ea7f4d..0000000
--- a/libcxx/test/libcxx/containers/unord/unord.map/debug.iterator.dereference.pass.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// <unordered_map>
-
-// Dereference non-dereferenceable iterator.
-
-// REQUIRES: has-unix-headers
-// UNSUPPORTED: !libcpp-has-legacy-debug-mode, c++03
-
-#include <unordered_map>
-#include <string>
-
-#include "check_assertion.h"
-#include "min_allocator.h"
-
-int main(int, char**) {
- {
- typedef std::unordered_map<int, std::string> C;
- C c;
- c.insert(std::make_pair(1, "one"));
- C::iterator i = c.end();
- TEST_LIBCPP_ASSERT_FAILURE(*i, "Attempted to dereference a non-dereferenceable unordered container iterator");
- }
-
- {
- typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- C c;
- c.insert(std::make_pair(1, "one"));
- C::iterator i = c.end();
- TEST_LIBCPP_ASSERT_FAILURE(*i, "Attempted to dereference a non-dereferenceable unordered container iterator");
- }
-
- return 0;
-}
diff --git a/libcxx/test/libcxx/containers/unord/unord.map/debug.iterator.increment.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.map/debug.iterator.increment.pass.cpp
deleted file mode 100644
index 2ed09bc..0000000
--- a/libcxx/test/libcxx/containers/unord/unord.map/debug.iterator.increment.pass.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// <unordered_map>
-
-// Increment iterator past end.
-
-// REQUIRES: has-unix-headers
-// UNSUPPORTED: !libcpp-has-legacy-debug-mode, c++03
-
-#include <unordered_map>
-#include <cassert>
-#include <string>
-
-#include "check_assertion.h"
-#include "min_allocator.h"
-
-int main(int, char**) {
- {
- typedef std::unordered_map<int, std::string> C;
- C c;
- c.insert(std::make_pair(1, "one"));
- C::iterator i = c.begin();
- ++i;
- assert(i == c.end());
- TEST_LIBCPP_ASSERT_FAILURE(++i, "Attempted to increment a non-incrementable unordered container iterator");
- }
-
- {
- typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- C c;
- c.insert(std::make_pair(1, "one"));
- C::iterator i = c.begin();
- ++i;
- assert(i == c.end());
- TEST_LIBCPP_ASSERT_FAILURE(++i, "Attempted to increment a non-incrementable unordered container iterator");
- }
-
- return 0;
-}
diff --git a/libcxx/test/libcxx/containers/unord/unord.map/debug.local_iterator.dereference.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.map/debug.local_iterator.dereference.pass.cpp
deleted file mode 100644
index 2e4e62d..0000000
--- a/libcxx/test/libcxx/containers/unord/unord.map/debug.local_iterator.dereference.pass.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// <unordered_map>
-
-// Dereference non-dereferenceable iterator.
-
-// REQUIRES: has-unix-headers
-// UNSUPPORTED: !libcpp-has-legacy-debug-mode, c++03
-
-#include <unordered_map>
-#include <string>
-
-#include "check_assertion.h"
-#include "min_allocator.h"
-
-int main(int, char**) {
- {
- typedef std::unordered_map<int, std::string> C;
- C c(1);
- C::local_iterator i = c.end(0);
- TEST_LIBCPP_ASSERT_FAILURE(*i, "Attempted to dereference a non-dereferenceable unordered container local_iterator");
- }
-
- {
- typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- C c(1);
- C::local_iterator i = c.end(0);
- TEST_LIBCPP_ASSERT_FAILURE(*i, "Attempted to dereference a non-dereferenceable unordered container local_iterator");
- }
-
- return 0;
-}
diff --git a/libcxx/test/libcxx/containers/unord/unord.map/debug.local_iterator.increment.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.map/debug.local_iterator.increment.pass.cpp
deleted file mode 100644
index 2859926..0000000
--- a/libcxx/test/libcxx/containers/unord/unord.map/debug.local_iterator.increment.pass.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// <unordered_map>
-
-// Increment local_iterator past end.
-
-// REQUIRES: has-unix-headers
-// UNSUPPORTED: !libcpp-has-legacy-debug-mode, c++03
-
-#include <unordered_map>
-#include <string>
-#include <cassert>
-
-#include "check_assertion.h"
-#include "min_allocator.h"
-
-int main(int, char**) {
- {
- typedef std::unordered_map<int, std::string> C;
- C c;
- c.insert(std::make_pair(42, std::string()));
- C::size_type b = c.bucket(42);
- C::local_iterator i = c.begin(b);
- assert(i != c.end(b));
- ++i;
- assert(i == c.end(b));
- TEST_LIBCPP_ASSERT_FAILURE(++i, "Attempted to increment a non-incrementable unordered container local_iterator");
- }
-
- {
- typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- C c({{42, std::string()}});
- C::size_type b = c.bucket(42);
- C::local_iterator i = c.begin(b);
- assert(i != c.end(b));
- ++i;
- assert(i == c.end(b));
- TEST_LIBCPP_ASSERT_FAILURE(++i, "Attempted to increment a non-incrementable unordered container local_iterator");
- }
-
- return 0;
-}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multimap/assert.iterator.dereference.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multimap/assert.iterator.dereference.pass.cpp
new file mode 100644
index 0000000..d295a82
--- /dev/null
+++ b/libcxx/test/libcxx/containers/unord/unord.multimap/assert.iterator.dereference.pass.cpp
@@ -0,0 +1,52 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_map>
+
+// Dereference non-dereferenceable iterator.
+
+// REQUIRES: has-unix-headers, libcpp-hardening-mode={{extensive|debug}}
+// UNSUPPORTED: c++03
+// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing
+
+#include <string>
+#include <unordered_map>
+
+#include "check_assertion.h"
+#include "min_allocator.h"
+
+int main(int, char**) {
+ {
+ typedef std::unordered_multimap<int, std::string> C;
+ C c;
+ c.insert(std::make_pair(1, "one"));
+ C::iterator i = c.end();
+ TEST_LIBCPP_ASSERT_FAILURE(*i, "Attempted to dereference a non-dereferenceable unordered container iterator");
+ C::const_iterator i2 = c.cend();
+ TEST_LIBCPP_ASSERT_FAILURE(
+ *i2, "Attempted to dereference a non-dereferenceable unordered container const_iterator");
+ }
+
+ {
+ typedef std::unordered_multimap<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ C c;
+ c.insert(std::make_pair(1, "one"));
+ C::iterator i = c.end();
+ TEST_LIBCPP_ASSERT_FAILURE(*i, "Attempted to dereference a non-dereferenceable unordered container iterator");
+ C::const_iterator i2 = c.cend();
+ TEST_LIBCPP_ASSERT_FAILURE(
+ *i2, "Attempted to dereference a non-dereferenceable unordered container const_iterator");
+ }
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multimap/assert.iterator.increment.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multimap/assert.iterator.increment.pass.cpp
new file mode 100644
index 0000000..4247edc
--- /dev/null
+++ b/libcxx/test/libcxx/containers/unord/unord.multimap/assert.iterator.increment.pass.cpp
@@ -0,0 +1,59 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_map>
+
+// Increment iterator past end.
+
+// REQUIRES: has-unix-headers, libcpp-hardening-mode={{extensive|debug}}
+// UNSUPPORTED: c++03
+// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing
+
+#include <unordered_map>
+#include <cassert>
+#include <string>
+
+#include "check_assertion.h"
+#include "min_allocator.h"
+
+int main(int, char**) {
+ {
+ typedef std::unordered_multimap<int, std::string> C;
+ C c;
+ c.insert(std::make_pair(1, "one"));
+ C::iterator i = c.begin();
+ ++i;
+ assert(i == c.end());
+ TEST_LIBCPP_ASSERT_FAILURE(++i, "Attempted to increment a non-incrementable unordered container iterator");
+ C::const_iterator i2 = c.cbegin();
+ ++i2;
+ assert(i2 == c.cend());
+ TEST_LIBCPP_ASSERT_FAILURE(++i2, "Attempted to increment a non-incrementable unordered container const_iterator");
+ }
+
+ {
+ typedef std::unordered_multimap<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ C c;
+ c.insert(std::make_pair(1, "one"));
+ C::iterator i = c.begin();
+ ++i;
+ assert(i == c.end());
+ TEST_LIBCPP_ASSERT_FAILURE(++i, "Attempted to increment a non-incrementable unordered container iterator");
+ C::const_iterator i2 = c.cbegin();
+ ++i2;
+ assert(i2 == c.cend());
+ TEST_LIBCPP_ASSERT_FAILURE(++i2, "Attempted to increment a non-incrementable unordered container const_iterator");
+ }
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multimap/assert.local_iterator.dereference.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multimap/assert.local_iterator.dereference.pass.cpp
new file mode 100644
index 0000000..7ea8796
--- /dev/null
+++ b/libcxx/test/libcxx/containers/unord/unord.multimap/assert.local_iterator.dereference.pass.cpp
@@ -0,0 +1,50 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_map>
+
+// Dereference non-dereferenceable iterator.
+
+// REQUIRES: has-unix-headers, libcpp-hardening-mode={{extensive|debug}}
+// UNSUPPORTED: c++03
+// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing
+
+#include <unordered_map>
+#include <string>
+
+#include "check_assertion.h"
+#include "min_allocator.h"
+
+int main(int, char**) {
+ {
+ typedef std::unordered_multimap<int, std::string> C;
+ C c(1);
+ C::local_iterator i = c.end(0);
+ TEST_LIBCPP_ASSERT_FAILURE(*i, "Attempted to dereference a non-dereferenceable unordered container local_iterator");
+ C::const_local_iterator i2 = c.cend(0);
+ TEST_LIBCPP_ASSERT_FAILURE(
+ *i2, "Attempted to dereference a non-dereferenceable unordered container const_local_iterator");
+ }
+
+ {
+ typedef std::unordered_multimap<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ C c(1);
+ C::local_iterator i = c.end(0);
+ TEST_LIBCPP_ASSERT_FAILURE(*i, "Attempted to dereference a non-dereferenceable unordered container local_iterator");
+ C::const_local_iterator i2 = c.cend(0);
+ TEST_LIBCPP_ASSERT_FAILURE(
+ *i2, "Attempted to dereference a non-dereferenceable unordered container const_local_iterator");
+ }
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multimap/assert.local_iterator.increment.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multimap/assert.local_iterator.increment.pass.cpp
new file mode 100644
index 0000000..ffa3fec
--- /dev/null
+++ b/libcxx/test/libcxx/containers/unord/unord.multimap/assert.local_iterator.increment.pass.cpp
@@ -0,0 +1,67 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_map>
+
+// Increment local_iterator past end.
+
+// REQUIRES: has-unix-headers, libcpp-hardening-mode={{extensive|debug}}
+// UNSUPPORTED: c++03
+// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing
+
+#include <unordered_map>
+#include <cassert>
+#include <string>
+
+#include "check_assertion.h"
+#include "min_allocator.h"
+
+int main(int, char**) {
+ {
+ typedef std::unordered_multimap<int, std::string> C;
+ C c;
+ c.insert(std::make_pair(42, std::string()));
+ C::size_type b = c.bucket(42);
+ C::local_iterator i = c.begin(b);
+ assert(i != c.end(b));
+ ++i;
+ assert(i == c.end(b));
+ TEST_LIBCPP_ASSERT_FAILURE(++i, "Attempted to increment a non-incrementable unordered container local_iterator");
+ C::const_local_iterator i2 = c.cbegin(b);
+ assert(i2 != c.cend(b));
+ ++i2;
+ assert(i2 == c.cend(b));
+ TEST_LIBCPP_ASSERT_FAILURE(
+ ++i2, "Attempted to increment a non-incrementable unordered container const_local_iterator");
+ }
+
+ {
+ typedef std::unordered_multimap<int,
+ std::string,
+ std::hash<int>,
+ std::equal_to<int>,
+ min_allocator<std::pair<const int, std::string>>>
+ C;
+ C c({{1, std::string()}});
+ c.insert(std::make_pair(42, std::string()));
+ C::size_type b = c.bucket(42);
+ C::local_iterator i = c.begin(b);
+ assert(i != c.end(b));
+ ++i;
+ assert(i == c.end(b));
+ TEST_LIBCPP_ASSERT_FAILURE(++i, "Attempted to increment a non-incrementable unordered container local_iterator");
+ C::const_local_iterator i2 = c.cbegin(b);
+ assert(i2 != c.cend(b));
+ ++i2;
+ assert(i2 == c.cend(b));
+ TEST_LIBCPP_ASSERT_FAILURE(
+ ++i2, "Attempted to increment a non-incrementable unordered container const_local_iterator");
+ }
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multimap/debug.iterator.dereference.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multimap/debug.iterator.dereference.pass.cpp
deleted file mode 100644
index 3dad48b..0000000
--- a/libcxx/test/libcxx/containers/unord/unord.multimap/debug.iterator.dereference.pass.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// <unordered_map>
-
-// Dereference non-dereferenceable iterator.
-
-// REQUIRES: has-unix-headers
-// UNSUPPORTED: !libcpp-has-legacy-debug-mode, c++03
-
-#include <string>
-#include <unordered_map>
-
-#include "check_assertion.h"
-#include "min_allocator.h"
-
-int main(int, char**) {
- {
- typedef std::unordered_multimap<int, std::string> C;
- C c;
- c.insert(std::make_pair(1, "one"));
- C::iterator i = c.end();
- TEST_LIBCPP_ASSERT_FAILURE(*i, "Attempted to dereference a non-dereferenceable unordered container iterator");
- }
-
- {
- typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- C c;
- c.insert(std::make_pair(1, "one"));
- C::iterator i = c.end();
- TEST_LIBCPP_ASSERT_FAILURE(*i, "Attempted to dereference a non-dereferenceable unordered container iterator");
- }
-
- return 0;
-}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multimap/debug.iterator.increment.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multimap/debug.iterator.increment.pass.cpp
deleted file mode 100644
index b02bac6..0000000
--- a/libcxx/test/libcxx/containers/unord/unord.multimap/debug.iterator.increment.pass.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// <unordered_map>
-
-// Increment iterator past end.
-
-// REQUIRES: has-unix-headers
-// UNSUPPORTED: !libcpp-has-legacy-debug-mode, c++03
-
-#include <unordered_map>
-#include <cassert>
-#include <string>
-
-#include "check_assertion.h"
-#include "min_allocator.h"
-
-int main(int, char**) {
- {
- typedef std::unordered_multimap<int, std::string> C;
- C c;
- c.insert(std::make_pair(1, "one"));
- C::iterator i = c.begin();
- ++i;
- assert(i == c.end());
- TEST_LIBCPP_ASSERT_FAILURE(++i, "Attempted to increment a non-incrementable unordered container iterator");
- }
-
- {
- typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- C c;
- c.insert(std::make_pair(1, "one"));
- C::iterator i = c.begin();
- ++i;
- assert(i == c.end());
- TEST_LIBCPP_ASSERT_FAILURE(++i, "Attempted to increment a non-incrementable unordered container iterator");
- }
-
- return 0;
-}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multimap/debug.local_iterator.dereference.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multimap/debug.local_iterator.dereference.pass.cpp
deleted file mode 100644
index 9719ba58..0000000
--- a/libcxx/test/libcxx/containers/unord/unord.multimap/debug.local_iterator.dereference.pass.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// <unordered_map>
-
-// Dereference non-dereferenceable iterator.
-
-// REQUIRES: has-unix-headers
-// UNSUPPORTED: !libcpp-has-legacy-debug-mode, c++03
-
-#include <unordered_map>
-#include <string>
-
-#include "check_assertion.h"
-#include "min_allocator.h"
-
-int main(int, char**) {
- {
- typedef std::unordered_multimap<int, std::string> C;
- C c(1);
- C::local_iterator i = c.end(0);
- TEST_LIBCPP_ASSERT_FAILURE(*i, "Attempted to dereference a non-dereferenceable unordered container local_iterator");
- }
-
- {
- typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- C c(1);
- C::local_iterator i = c.end(0);
- TEST_LIBCPP_ASSERT_FAILURE(*i, "Attempted to dereference a non-dereferenceable unordered container local_iterator");
- }
-
- return 0;
-}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multimap/debug.local_iterator.increment.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multimap/debug.local_iterator.increment.pass.cpp
deleted file mode 100644
index 2f74a19..0000000
--- a/libcxx/test/libcxx/containers/unord/unord.multimap/debug.local_iterator.increment.pass.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// <unordered_map>
-
-// Increment local_iterator past end.
-
-// REQUIRES: has-unix-headers
-// UNSUPPORTED: !libcpp-has-legacy-debug-mode, c++03
-
-#include <unordered_map>
-#include <cassert>
-#include <string>
-
-#include "check_assertion.h"
-#include "min_allocator.h"
-
-int main(int, char**) {
- {
- typedef std::unordered_multimap<int, std::string> C;
- C c;
- c.insert(std::make_pair(42, std::string()));
- C::size_type b = c.bucket(42);
- C::local_iterator i = c.begin(b);
- assert(i != c.end(b));
- ++i;
- assert(i == c.end(b));
- TEST_LIBCPP_ASSERT_FAILURE(++i, "Attempted to increment a non-incrementable unordered container local_iterator");
- }
-
- {
- typedef std::unordered_multimap<int, std::string, std::hash<int>, std::equal_to<int>,
- min_allocator<std::pair<const int, std::string>>> C;
- C c({{1, std::string()}});
- c.insert(std::make_pair(42, std::string()));
- C::size_type b = c.bucket(42);
- C::local_iterator i = c.begin(b);
- assert(i != c.end(b));
- ++i;
- assert(i == c.end(b));
- TEST_LIBCPP_ASSERT_FAILURE(++i, "Attempted to increment a non-incrementable unordered container local_iterator");
- }
-
- return 0;
-}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multiset/assert.iterator.dereference.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multiset/assert.iterator.dereference.pass.cpp
new file mode 100644
index 0000000..31edd60
--- /dev/null
+++ b/libcxx/test/libcxx/containers/unord/unord.multiset/assert.iterator.dereference.pass.cpp
@@ -0,0 +1,46 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_set>
+
+// Dereference non-dereferenceable iterator.
+
+// REQUIRES: has-unix-headers, libcpp-hardening-mode={{extensive|debug}}
+// UNSUPPORTED: c++03
+// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing
+
+#include <unordered_set>
+
+#include "check_assertion.h"
+#include "min_allocator.h"
+
+int main(int, char**) {
+ {
+ typedef int T;
+ typedef std::unordered_multiset<T> C;
+ C c(1);
+ C::iterator i = c.end();
+ TEST_LIBCPP_ASSERT_FAILURE(*i, "Attempted to dereference a non-dereferenceable unordered container const_iterator");
+ C::const_iterator i2 = c.cend();
+ TEST_LIBCPP_ASSERT_FAILURE(
+ *i2, "Attempted to dereference a non-dereferenceable unordered container const_iterator");
+ }
+
+ {
+ typedef int T;
+ typedef std::unordered_multiset<T, std::hash<T>, std::equal_to<T>, min_allocator<T>> C;
+ C c(1);
+ C::iterator i = c.end();
+ TEST_LIBCPP_ASSERT_FAILURE(*i, "Attempted to dereference a non-dereferenceable unordered container const_iterator");
+ C::const_iterator i2 = c.cend();
+ TEST_LIBCPP_ASSERT_FAILURE(
+ *i2, "Attempted to dereference a non-dereferenceable unordered container const_iterator");
+ }
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multiset/assert.iterator.increment.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multiset/assert.iterator.increment.pass.cpp
new file mode 100644
index 0000000..0e0e4aa
--- /dev/null
+++ b/libcxx/test/libcxx/containers/unord/unord.multiset/assert.iterator.increment.pass.cpp
@@ -0,0 +1,58 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_set>
+
+// Increment iterator past end.
+
+// REQUIRES: has-unix-headers, libcpp-hardening-mode={{extensive|debug}}
+// UNSUPPORTED: c++03
+// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing
+
+#include <unordered_set>
+#include <cassert>
+
+#include "check_assertion.h"
+#include "min_allocator.h"
+
+int main(int, char**) {
+ {
+ typedef int T;
+ typedef std::unordered_multiset<T> C;
+ C c;
+ c.insert(42);
+ C::iterator i = c.begin();
+ assert(i != c.end());
+ ++i;
+ assert(i == c.end());
+ TEST_LIBCPP_ASSERT_FAILURE(++i, "Attempted to increment a non-incrementable unordered container const_iterator");
+ C::const_iterator i2 = c.cbegin();
+ assert(i2 != c.cend());
+ ++i2;
+ assert(i2 == c.cend());
+ TEST_LIBCPP_ASSERT_FAILURE(++i2, "Attempted to increment a non-incrementable unordered container const_iterator");
+ }
+
+ {
+ typedef int T;
+ typedef std::unordered_multiset<T, std::hash<T>, std::equal_to<T>, min_allocator<T>> C;
+ C c({42});
+ C::iterator i = c.begin();
+ assert(i != c.end());
+ ++i;
+ assert(i == c.end());
+ TEST_LIBCPP_ASSERT_FAILURE(++i, "Attempted to increment a non-incrementable unordered container const_iterator");
+ C::const_iterator i2 = c.cbegin();
+ assert(i2 != c.cend());
+ ++i2;
+ assert(i2 == c.cend());
+ TEST_LIBCPP_ASSERT_FAILURE(++i2, "Attempted to increment a non-incrementable unordered container const_iterator");
+ }
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multiset/assert.local_iterator.dereference.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multiset/assert.local_iterator.dereference.pass.cpp
new file mode 100644
index 0000000..fe833c4
--- /dev/null
+++ b/libcxx/test/libcxx/containers/unord/unord.multiset/assert.local_iterator.dereference.pass.cpp
@@ -0,0 +1,48 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_set>
+
+// Dereference non-dereferenceable iterator.
+
+// REQUIRES: has-unix-headers, libcpp-hardening-mode={{extensive|debug}}
+// UNSUPPORTED: c++03
+// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing
+
+#include <unordered_set>
+
+#include "check_assertion.h"
+#include "min_allocator.h"
+
+int main(int, char**) {
+ {
+ typedef int T;
+ typedef std::unordered_multiset<T> C;
+ C c(1);
+ C::local_iterator i = c.end(0);
+ TEST_LIBCPP_ASSERT_FAILURE(
+ *i, "Attempted to dereference a non-dereferenceable unordered container const_local_iterator");
+ C::const_local_iterator i2 = c.cend(0);
+ TEST_LIBCPP_ASSERT_FAILURE(
+ *i2, "Attempted to dereference a non-dereferenceable unordered container const_local_iterator");
+ }
+
+ {
+ typedef int T;
+ typedef std::unordered_multiset<T, std::hash<T>, std::equal_to<T>, min_allocator<T>> C;
+ C c(1);
+ C::local_iterator i = c.end(0);
+ TEST_LIBCPP_ASSERT_FAILURE(
+ *i, "Attempted to dereference a non-dereferenceable unordered container const_local_iterator");
+ C::const_local_iterator i2 = c.cend(0);
+ TEST_LIBCPP_ASSERT_FAILURE(
+ *i2, "Attempted to dereference a non-dereferenceable unordered container const_local_iterator");
+ }
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multiset/assert.local_iterator.increment.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multiset/assert.local_iterator.increment.pass.cpp
new file mode 100644
index 0000000..142c07f
--- /dev/null
+++ b/libcxx/test/libcxx/containers/unord/unord.multiset/assert.local_iterator.increment.pass.cpp
@@ -0,0 +1,64 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_set>
+
+// Increment local_iterator past end.
+
+// REQUIRES: has-unix-headers, libcpp-hardening-mode={{extensive|debug}}
+// UNSUPPORTED: c++03
+// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing
+
+#include <unordered_set>
+#include <cassert>
+
+#include "check_assertion.h"
+#include "min_allocator.h"
+
+int main(int, char**) {
+ {
+ typedef int T;
+ typedef std::unordered_multiset<T> C;
+ C c;
+ c.insert(42);
+ C::size_type b = c.bucket(42);
+ C::local_iterator i = c.begin(b);
+ assert(i != c.end(b));
+ ++i;
+ assert(i == c.end(b));
+ TEST_LIBCPP_ASSERT_FAILURE(
+ ++i, "Attempted to increment a non-incrementable unordered container const_local_iterator");
+ C::const_local_iterator i2 = c.cbegin(b);
+ assert(i2 != c.cend(b));
+ ++i2;
+ assert(i2 == c.cend(b));
+ TEST_LIBCPP_ASSERT_FAILURE(
+ ++i2, "Attempted to increment a non-incrementable unordered container const_local_iterator");
+ }
+
+ {
+ typedef int T;
+ typedef std::unordered_multiset<T, std::hash<T>, std::equal_to<T>, min_allocator<T>> C;
+ C c({42});
+ C::size_type b = c.bucket(42);
+ C::local_iterator i = c.begin(b);
+ assert(i != c.end(b));
+ ++i;
+ assert(i == c.end(b));
+ TEST_LIBCPP_ASSERT_FAILURE(
+ ++i, "Attempted to increment a non-incrementable unordered container const_local_iterator");
+ C::const_local_iterator i2 = c.cbegin(b);
+ assert(i2 != c.cend(b));
+ ++i2;
+ assert(i2 == c.cend(b));
+ TEST_LIBCPP_ASSERT_FAILURE(
+ ++i2, "Attempted to increment a non-incrementable unordered container const_local_iterator");
+ }
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multiset/debug.iterator.dereference.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multiset/debug.iterator.dereference.pass.cpp
deleted file mode 100644
index 51cb9a6..0000000
--- a/libcxx/test/libcxx/containers/unord/unord.multiset/debug.iterator.dereference.pass.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// <unordered_set>
-
-// Dereference non-dereferenceable iterator.
-
-// REQUIRES: has-unix-headers
-// UNSUPPORTED: !libcpp-has-legacy-debug-mode, c++03
-
-#include <unordered_set>
-
-#include "check_assertion.h"
-#include "min_allocator.h"
-
-int main(int, char**) {
- {
- typedef int T;
- typedef std::unordered_multiset<T> C;
- C c(1);
- C::iterator i = c.end();
- TEST_LIBCPP_ASSERT_FAILURE(*i, "Attempted to dereference a non-dereferenceable unordered container const_iterator");
- }
-
- {
- typedef int T;
- typedef std::unordered_multiset<T, std::hash<T>, std::equal_to<T>, min_allocator<T>> C;
- C c(1);
- C::iterator i = c.end();
- TEST_LIBCPP_ASSERT_FAILURE(*i, "Attempted to dereference a non-dereferenceable unordered container const_iterator");
- }
-
- return 0;
-}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multiset/debug.iterator.increment.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multiset/debug.iterator.increment.pass.cpp
deleted file mode 100644
index 17b8c77..0000000
--- a/libcxx/test/libcxx/containers/unord/unord.multiset/debug.iterator.increment.pass.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// <unordered_set>
-
-// Increment iterator past end.
-
-// REQUIRES: has-unix-headers
-// UNSUPPORTED: !libcpp-has-legacy-debug-mode, c++03
-
-#include <unordered_set>
-#include <cassert>
-
-#include "check_assertion.h"
-#include "min_allocator.h"
-
-int main(int, char**) {
- {
- typedef int T;
- typedef std::unordered_multiset<T> C;
- C c;
- c.insert(42);
- C::iterator i = c.begin();
- assert(i != c.end());
- ++i;
- assert(i == c.end());
- TEST_LIBCPP_ASSERT_FAILURE(++i, "Attempted to increment a non-incrementable unordered container const_iterator");
- }
-
- {
- typedef int T;
- typedef std::unordered_multiset<T, std::hash<T>, std::equal_to<T>, min_allocator<T>> C;
- C c({42});
- C::iterator i = c.begin();
- assert(i != c.end());
- ++i;
- assert(i == c.end());
- TEST_LIBCPP_ASSERT_FAILURE(++i, "Attempted to increment a non-incrementable unordered container const_iterator");
- }
-
- return 0;
-}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multiset/debug.local_iterator.dereference.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multiset/debug.local_iterator.dereference.pass.cpp
deleted file mode 100644
index 24102a4..0000000
--- a/libcxx/test/libcxx/containers/unord/unord.multiset/debug.local_iterator.dereference.pass.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// <unordered_set>
-
-// Dereference non-dereferenceable iterator.
-
-// REQUIRES: has-unix-headers
-// UNSUPPORTED: !libcpp-has-legacy-debug-mode, c++03
-
-#include <unordered_set>
-
-#include "check_assertion.h"
-#include "min_allocator.h"
-
-int main(int, char**) {
- {
- typedef int T;
- typedef std::unordered_multiset<T> C;
- C c(1);
- C::local_iterator i = c.end(0);
- TEST_LIBCPP_ASSERT_FAILURE(
- *i, "Attempted to dereference a non-dereferenceable unordered container const_local_iterator");
- }
-
- {
- typedef int T;
- typedef std::unordered_multiset<T, std::hash<T>, std::equal_to<T>, min_allocator<T>> C;
- C c(1);
- C::local_iterator i = c.end(0);
- TEST_LIBCPP_ASSERT_FAILURE(
- *i, "Attempted to dereference a non-dereferenceable unordered container const_local_iterator");
- }
-
- return 0;
-}
diff --git a/libcxx/test/libcxx/containers/unord/unord.multiset/debug.local_iterator.increment.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.multiset/debug.local_iterator.increment.pass.cpp
deleted file mode 100644
index 3f70ba2..0000000
--- a/libcxx/test/libcxx/containers/unord/unord.multiset/debug.local_iterator.increment.pass.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// <unordered_set>
-
-// Increment local_iterator past end.
-
-// REQUIRES: has-unix-headers
-// UNSUPPORTED: !libcpp-has-legacy-debug-mode, c++03
-
-#include <unordered_set>
-#include <cassert>
-
-#include "check_assertion.h"
-#include "min_allocator.h"
-
-int main(int, char**) {
- {
- typedef int T;
- typedef std::unordered_multiset<T> C;
- C c;
- c.insert(42);
- C::size_type b = c.bucket(42);
- C::local_iterator i = c.begin(b);
- assert(i != c.end(b));
- ++i;
- assert(i == c.end(b));
- TEST_LIBCPP_ASSERT_FAILURE(++i,
- "Attempted to increment a non-incrementable unordered container const_local_iterator");
- }
-
- {
- typedef int T;
- typedef std::unordered_multiset<T, std::hash<T>, std::equal_to<T>, min_allocator<T>> C;
- C c({42});
- C::size_type b = c.bucket(42);
- C::local_iterator i = c.begin(b);
- assert(i != c.end(b));
- ++i;
- assert(i == c.end(b));
- TEST_LIBCPP_ASSERT_FAILURE(++i,
- "Attempted to increment a non-incrementable unordered container const_local_iterator");
- }
-
- return 0;
-}
diff --git a/libcxx/test/libcxx/containers/unord/unord.set/assert.iterator.dereference.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.set/assert.iterator.dereference.pass.cpp
new file mode 100644
index 0000000..8464601
--- /dev/null
+++ b/libcxx/test/libcxx/containers/unord/unord.set/assert.iterator.dereference.pass.cpp
@@ -0,0 +1,46 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_set>
+
+// Dereference non-dereferenceable iterator.
+
+// REQUIRES: has-unix-headers, libcpp-hardening-mode={{extensive|debug}}
+// UNSUPPORTED: c++03
+// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing
+
+#include <unordered_set>
+
+#include "check_assertion.h"
+#include "min_allocator.h"
+
+int main(int, char**) {
+ {
+ typedef int T;
+ typedef std::unordered_set<T> C;
+ C c(1);
+ C::iterator i = c.end();
+ TEST_LIBCPP_ASSERT_FAILURE(*i, "Attempted to dereference a non-dereferenceable unordered container const_iterator");
+ C::const_iterator i2 = c.cend();
+ TEST_LIBCPP_ASSERT_FAILURE(
+ *i2, "Attempted to dereference a non-dereferenceable unordered container const_iterator");
+ }
+
+ {
+ typedef int T;
+ typedef std::unordered_set<T, std::hash<T>, std::equal_to<T>, min_allocator<T>> C;
+ C c(1);
+ C::iterator i = c.end();
+ TEST_LIBCPP_ASSERT_FAILURE(*i, "Attempted to dereference a non-dereferenceable unordered container const_iterator");
+ C::const_iterator i2 = c.cend();
+ TEST_LIBCPP_ASSERT_FAILURE(
+ *i2, "Attempted to dereference a non-dereferenceable unordered container const_iterator");
+ }
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx/containers/unord/unord.set/assert.iterator.increment.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.set/assert.iterator.increment.pass.cpp
new file mode 100644
index 0000000..2944688
--- /dev/null
+++ b/libcxx/test/libcxx/containers/unord/unord.set/assert.iterator.increment.pass.cpp
@@ -0,0 +1,58 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_set>
+
+// Increment iterator past end.
+
+// REQUIRES: has-unix-headers, libcpp-hardening-mode={{extensive|debug}}
+// UNSUPPORTED: c++03
+// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing
+
+#include <unordered_set>
+#include <cassert>
+
+#include "check_assertion.h"
+#include "min_allocator.h"
+
+int main(int, char**) {
+ {
+ typedef int T;
+ typedef std::unordered_set<T> C;
+ C c;
+ c.insert(42);
+ C::iterator i = c.begin();
+ assert(i != c.end());
+ ++i;
+ assert(i == c.end());
+ TEST_LIBCPP_ASSERT_FAILURE(++i, "Attempted to increment a non-incrementable unordered container const_iterator");
+ C::const_iterator i2 = c.cbegin();
+ assert(i2 != c.cend());
+ ++i2;
+ assert(i2 == c.cend());
+ TEST_LIBCPP_ASSERT_FAILURE(++i2, "Attempted to increment a non-incrementable unordered container const_iterator");
+ }
+
+ {
+ typedef int T;
+ typedef std::unordered_set<T, std::hash<T>, std::equal_to<T>, min_allocator<T>> C;
+ C c({42});
+ C::iterator i = c.begin();
+ assert(i != c.end());
+ ++i;
+ assert(i == c.end());
+ TEST_LIBCPP_ASSERT_FAILURE(++i, "Attempted to increment a non-incrementable unordered container const_iterator");
+ C::const_iterator i2 = c.cbegin();
+ assert(i2 != c.cend());
+ ++i2;
+ assert(i2 == c.cend());
+ TEST_LIBCPP_ASSERT_FAILURE(++i2, "Attempted to increment a non-incrementable unordered container const_iterator");
+ }
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx/containers/unord/unord.set/assert.local_iterator.dereference.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.set/assert.local_iterator.dereference.pass.cpp
new file mode 100644
index 0000000..7163e37
--- /dev/null
+++ b/libcxx/test/libcxx/containers/unord/unord.set/assert.local_iterator.dereference.pass.cpp
@@ -0,0 +1,48 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_set>
+
+// Dereference non-dereferenceable iterator.
+
+// REQUIRES: has-unix-headers, libcpp-hardening-mode={{extensive|debug}}
+// UNSUPPORTED: c++03
+// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing
+
+#include <unordered_set>
+
+#include "check_assertion.h"
+#include "min_allocator.h"
+
+int main(int, char**) {
+ {
+ typedef int T;
+ typedef std::unordered_set<T> C;
+ C c(1);
+ C::local_iterator i = c.end(0);
+ TEST_LIBCPP_ASSERT_FAILURE(
+ *i, "Attempted to dereference a non-dereferenceable unordered container const_local_iterator");
+ C::const_local_iterator i2 = c.cend(0);
+ TEST_LIBCPP_ASSERT_FAILURE(
+ *i2, "Attempted to dereference a non-dereferenceable unordered container const_local_iterator");
+ }
+
+ {
+ typedef int T;
+ typedef std::unordered_set<T, std::hash<T>, std::equal_to<T>, min_allocator<T>> C;
+ C c(1);
+ C::local_iterator i = c.end(0);
+ TEST_LIBCPP_ASSERT_FAILURE(
+ *i, "Attempted to dereference a non-dereferenceable unordered container const_local_iterator");
+ C::const_local_iterator i2 = c.cend(0);
+ TEST_LIBCPP_ASSERT_FAILURE(
+ *i2, "Attempted to dereference a non-dereferenceable unordered container const_local_iterator");
+ }
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx/containers/unord/unord.set/assert.local_iterator.increment.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.set/assert.local_iterator.increment.pass.cpp
new file mode 100644
index 0000000..c9fe5af
--- /dev/null
+++ b/libcxx/test/libcxx/containers/unord/unord.set/assert.local_iterator.increment.pass.cpp
@@ -0,0 +1,64 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <unordered_set>
+
+// Increment local_iterator past end.
+
+// REQUIRES: has-unix-headers, libcpp-hardening-mode={{extensive|debug}}
+// UNSUPPORTED: c++03
+// XFAIL: libcpp-hardening-mode=debug && availability-verbose_abort-missing
+
+#include <unordered_set>
+#include <cassert>
+
+#include "check_assertion.h"
+#include "min_allocator.h"
+
+int main(int, char**) {
+ {
+ typedef int T;
+ typedef std::unordered_set<T> C;
+ C c;
+ c.insert(42);
+ C::size_type b = c.bucket(42);
+ C::local_iterator i = c.begin(b);
+ assert(i != c.end(b));
+ ++i;
+ assert(i == c.end(b));
+ TEST_LIBCPP_ASSERT_FAILURE(
+ ++i, "Attempted to increment a non-incrementable unordered container const_local_iterator");
+ C::const_local_iterator i2 = c.cbegin(b);
+ assert(i2 != c.cend(b));
+ ++i2;
+ assert(i2 == c.cend(b));
+ TEST_LIBCPP_ASSERT_FAILURE(
+ ++i2, "Attempted to increment a non-incrementable unordered container const_local_iterator");
+ }
+
+ {
+ typedef int T;
+ typedef std::unordered_set<T, std::hash<T>, std::equal_to<T>, min_allocator<T>> C;
+ C c({42});
+ C::size_type b = c.bucket(42);
+ C::local_iterator i = c.begin(b);
+ assert(i != c.end(b));
+ ++i;
+ assert(i == c.end(b));
+ TEST_LIBCPP_ASSERT_FAILURE(
+ ++i, "Attempted to increment a non-incrementable unordered container const_local_iterator");
+ C::const_local_iterator i2 = c.cbegin(b);
+ assert(i2 != c.cend(b));
+ ++i2;
+ assert(i2 == c.cend(b));
+ TEST_LIBCPP_ASSERT_FAILURE(
+ ++i2, "Attempted to increment a non-incrementable unordered container const_local_iterator");
+ }
+
+ return 0;
+}
diff --git a/libcxx/test/libcxx/containers/unord/unord.set/debug.iterator.dereference.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.set/debug.iterator.dereference.pass.cpp
deleted file mode 100644
index 49663b4..0000000
--- a/libcxx/test/libcxx/containers/unord/unord.set/debug.iterator.dereference.pass.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// <unordered_set>
-
-// Dereference non-dereferenceable iterator.
-
-// REQUIRES: has-unix-headers
-// UNSUPPORTED: !libcpp-has-legacy-debug-mode, c++03
-
-#include <unordered_set>
-
-#include "check_assertion.h"
-#include "min_allocator.h"
-
-int main(int, char**) {
- {
- typedef int T;
- typedef std::unordered_set<T> C;
- C c(1);
- C::iterator i = c.end();
- TEST_LIBCPP_ASSERT_FAILURE(*i, "Attempted to dereference a non-dereferenceable unordered container const_iterator");
- }
-
- {
- typedef int T;
- typedef std::unordered_set<T, std::hash<T>, std::equal_to<T>, min_allocator<T>> C;
- C c(1);
- C::iterator i = c.end();
- TEST_LIBCPP_ASSERT_FAILURE(*i, "Attempted to dereference a non-dereferenceable unordered container const_iterator");
- }
-
- return 0;
-}
diff --git a/libcxx/test/libcxx/containers/unord/unord.set/debug.iterator.increment.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.set/debug.iterator.increment.pass.cpp
deleted file mode 100644
index da3fbdc..0000000
--- a/libcxx/test/libcxx/containers/unord/unord.set/debug.iterator.increment.pass.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// <unordered_set>
-
-// Increment iterator past end.
-
-// REQUIRES: has-unix-headers
-// UNSUPPORTED: !libcpp-has-legacy-debug-mode, c++03
-
-#include <unordered_set>
-#include <cassert>
-
-#include "check_assertion.h"
-#include "min_allocator.h"
-
-int main(int, char**) {
- {
- typedef int T;
- typedef std::unordered_set<T> C;
- C c;
- c.insert(42);
- C::iterator i = c.begin();
- assert(i != c.end());
- ++i;
- assert(i == c.end());
- TEST_LIBCPP_ASSERT_FAILURE(++i, "Attempted to increment a non-incrementable unordered container const_iterator");
- }
-
- {
- typedef int T;
- typedef std::unordered_set<T, std::hash<T>, std::equal_to<T>, min_allocator<T>> C;
- C c({42});
- C::iterator i = c.begin();
- assert(i != c.end());
- ++i;
- assert(i == c.end());
- TEST_LIBCPP_ASSERT_FAILURE(++i, "Attempted to increment a non-incrementable unordered container const_iterator");
- }
-
- return 0;
-}
diff --git a/libcxx/test/libcxx/containers/unord/unord.set/debug.local_iterator.dereference.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.set/debug.local_iterator.dereference.pass.cpp
deleted file mode 100644
index 912edc2..0000000
--- a/libcxx/test/libcxx/containers/unord/unord.set/debug.local_iterator.dereference.pass.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// <unordered_set>
-
-// Dereference non-dereferenceable iterator.
-
-// REQUIRES: has-unix-headers
-// UNSUPPORTED: !libcpp-has-legacy-debug-mode, c++03
-
-#include <unordered_set>
-
-#include "check_assertion.h"
-#include "min_allocator.h"
-
-int main(int, char**) {
- {
- typedef int T;
- typedef std::unordered_set<T> C;
- C c(1);
- C::local_iterator i = c.end(0);
- TEST_LIBCPP_ASSERT_FAILURE(
- *i, "Attempted to dereference a non-dereferenceable unordered container const_local_iterator");
- }
-
- {
- typedef int T;
- typedef std::unordered_set<T, std::hash<T>, std::equal_to<T>, min_allocator<T>> C;
- C c(1);
- C::local_iterator i = c.end(0);
- TEST_LIBCPP_ASSERT_FAILURE(
- *i, "Attempted to dereference a non-dereferenceable unordered container const_local_iterator");
- }
-
- return 0;
-}
diff --git a/libcxx/test/libcxx/containers/unord/unord.set/debug.local_iterator.increment.pass.cpp b/libcxx/test/libcxx/containers/unord/unord.set/debug.local_iterator.increment.pass.cpp
deleted file mode 100644
index 42a62ae..0000000
--- a/libcxx/test/libcxx/containers/unord/unord.set/debug.local_iterator.increment.pass.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// <unordered_set>
-
-// Increment local_iterator past end.
-
-// REQUIRES: has-unix-headers
-// UNSUPPORTED: !libcpp-has-legacy-debug-mode, c++03
-
-#include <unordered_set>
-#include <cassert>
-
-#include "check_assertion.h"
-#include "min_allocator.h"
-
-int main(int, char**) {
- {
- typedef int T;
- typedef std::unordered_set<T> C;
- C c;
- c.insert(42);
- C::size_type b = c.bucket(42);
- C::local_iterator i = c.begin(b);
- assert(i != c.end(b));
- ++i;
- assert(i == c.end(b));
- TEST_LIBCPP_ASSERT_FAILURE(++i, "Attempted to increment a non-incrementable unordered container const_local_iterator");
- }
-
- {
- typedef int T;
- typedef std::unordered_set<T, std::hash<T>, std::equal_to<T>, min_allocator<T>> C;
- C c({42});
- C::size_type b = c.bucket(42);
- C::local_iterator i = c.begin(b);
- assert(i != c.end(b));
- ++i;
- assert(i == c.end(b));
- TEST_LIBCPP_ASSERT_FAILURE(++i, "Attempted to increment a non-incrementable unordered container const_local_iterator");
- }
-
- return 0;
-}