summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAbseil Team <absl-team@google.com>2024-10-16 13:39:05 (GMT)
committerCopybara-Service <copybara-worker@google.com>2024-10-16 13:39:54 (GMT)
commitdf1544bcee0c7ce35cd5ea0b3eb8cc81855a4140 (patch)
treef88f2aa3f96b3efadbc72f11b23b8ccb19b81725
parent62df7bdbc10887e094661e07ec2595b7920376fd (diff)
downloadgoogletest-df1544bcee0c7ce35cd5ea0b3eb8cc81855a4140.zip
googletest-df1544bcee0c7ce35cd5ea0b3eb8cc81855a4140.tar.gz
googletest-df1544bcee0c7ce35cd5ea0b3eb8cc81855a4140.tar.bz2
Avoid creating std::vector<const T> in UnorderedElementsAreArrayMatcher and others.
std::vector<const T> for trivially relocatable types is not allowed by C++ and is rejected by libc++ starting from https://github.com/llvm/llvm-project/commit/4e112e5c1c8511056030294af3264da35f95d93c PiperOrigin-RevId: 686487841 Change-Id: I3c90c7c0a6e8e23ffa5ebd1702a3f30ebc4a702f
-rw-r--r--googlemock/include/gmock/gmock-matchers.h13
1 files changed, 7 insertions, 6 deletions
diff --git a/googlemock/include/gmock/gmock-matchers.h b/googlemock/include/gmock/gmock-matchers.h
index 70e7a76..16cf9c3 100644
--- a/googlemock/include/gmock/gmock-matchers.h
+++ b/googlemock/include/gmock/gmock-matchers.h
@@ -1523,7 +1523,7 @@ class SomeOfArrayMatcher {
}
private:
- const ::std::vector<T> matchers_;
+ const std::vector<std::remove_const_t<T>> matchers_;
};
template <typename T>
@@ -3805,7 +3805,7 @@ class UnorderedElementsAreArrayMatcher {
private:
UnorderedMatcherRequire::Flags match_flags_;
- ::std::vector<T> matchers_;
+ std::vector<std::remove_const_t<T>> matchers_;
};
// Implements ElementsAreArray().
@@ -3826,7 +3826,7 @@ class ElementsAreArrayMatcher {
}
private:
- const ::std::vector<T> matchers_;
+ const std::vector<std::remove_const_t<T>> matchers_;
};
// Given a 2-tuple matcher tm of type Tuple2Matcher and a value second
@@ -4793,9 +4793,10 @@ Pointwise(const TupleMatcher& tuple_matcher, const Container& rhs) {
// Supports the Pointwise(m, {a, b, c}) syntax.
template <typename TupleMatcher, typename T>
-inline internal::PointwiseMatcher<TupleMatcher, std::vector<T>> Pointwise(
- const TupleMatcher& tuple_matcher, std::initializer_list<T> rhs) {
- return Pointwise(tuple_matcher, std::vector<T>(rhs));
+inline internal::PointwiseMatcher<TupleMatcher,
+ std::vector<std::remove_const_t<T>>>
+Pointwise(const TupleMatcher& tuple_matcher, std::initializer_list<T> rhs) {
+ return Pointwise(tuple_matcher, std::vector<std::remove_const_t<T>>(rhs));
}
// UnorderedPointwise(pair_matcher, rhs) matches an STL-style