summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--absl/algorithm/container.h4
-rw-r--r--absl/algorithm/container_test.cc11
-rw-r--r--absl/container/internal/raw_hash_set_allocator_test.cc4
-rw-r--r--ci/linux_docker_containers.sh4
4 files changed, 20 insertions, 3 deletions
diff --git a/absl/algorithm/container.h b/absl/algorithm/container.h
index 3c4fd733..bb3d1c7c 100644
--- a/absl/algorithm/container.h
+++ b/absl/algorithm/container.h
@@ -351,7 +351,9 @@ c_mismatch(C1& c1, C2& c2) {
auto last2 = container_algorithm_internal::c_end(c2);
for (; first1 != last1 && first2 != last2; ++first1, (void)++first2) {
- if (*first1 != *first2) {
+ // Negates equality because Cpp17EqualityComparable doesn't require clients
+ // to overload both `operator==` and `operator!=`.
+ if (!(*first1 == *first2)) {
break;
}
}
diff --git a/absl/algorithm/container_test.cc b/absl/algorithm/container_test.cc
index fb940560..605afc80 100644
--- a/absl/algorithm/container_test.cc
+++ b/absl/algorithm/container_test.cc
@@ -183,6 +183,17 @@ TEST_F(NonMutatingTest, Mismatch) {
EXPECT_EQ(result.first, sequence_.end());
EXPECT_EQ(result.second, std::prev(vector_.end()));
}
+ {
+ struct NoNotEquals {
+ constexpr bool operator==(NoNotEquals) const { return true; }
+ constexpr bool operator!=(NoNotEquals) const = delete;
+ };
+ std::vector<NoNotEquals> first;
+ std::list<NoNotEquals> second;
+
+ // Check this still compiles.
+ absl::c_mismatch(first, second);
+ }
}
TEST_F(NonMutatingTest, MismatchWithPredicate) {
diff --git a/absl/container/internal/raw_hash_set_allocator_test.cc b/absl/container/internal/raw_hash_set_allocator_test.cc
index 1a036085..e73f53fd 100644
--- a/absl/container/internal/raw_hash_set_allocator_test.cc
+++ b/absl/container/internal/raw_hash_set_allocator_test.cc
@@ -466,6 +466,9 @@ class PAlloc {
size_t id_ = std::numeric_limits<size_t>::max();
};
+// This doesn't compile with GCC 5.4 and 5.5 due to a bug in noexcept handing.
+#if !defined(__GNUC__) || __GNUC__ != 5 || (__GNUC_MINOR__ != 4 && \
+ __GNUC_MINOR__ != 5)
TEST(NoPropagateOn, Swap) {
using PA = PAlloc<char>;
using Table = raw_hash_set<Policy, Identity, std::equal_to<int32_t>, PA>;
@@ -475,6 +478,7 @@ TEST(NoPropagateOn, Swap) {
EXPECT_EQ(t1.get_allocator(), PA(1));
EXPECT_EQ(t2.get_allocator(), PA(2));
}
+#endif
TEST(NoPropagateOn, CopyConstruct) {
using PA = PAlloc<char>;
diff --git a/ci/linux_docker_containers.sh b/ci/linux_docker_containers.sh
index e42fa58b..752b5729 100644
--- a/ci/linux_docker_containers.sh
+++ b/ci/linux_docker_containers.sh
@@ -16,6 +16,6 @@
# Test scripts should source this file to get the identifiers.
readonly LINUX_ALPINE_CONTAINER="gcr.io/google.com/absl-177019/alpine:20191016"
-readonly LINUX_CLANG_LATEST_CONTAINER="gcr.io/google.com/absl-177019/linux_hybrid-latest:20200909"
-readonly LINUX_GCC_LATEST_CONTAINER="gcr.io/google.com/absl-177019/linux_hybrid-latest:20200909"
+readonly LINUX_CLANG_LATEST_CONTAINER="gcr.io/google.com/absl-177019/linux_hybrid-latest:20201008"
+readonly LINUX_GCC_LATEST_CONTAINER="gcr.io/google.com/absl-177019/linux_hybrid-latest:20201008"
readonly LINUX_GCC_49_CONTAINER="gcr.io/google.com/absl-177019/linux_gcc-4.9:20191018"