aboutsummaryrefslogtreecommitdiffstats
path: root/googlemock/include/gmock/gmock-matchers.h
diff options
context:
space:
mode:
authorkuzkry <krystian.kuzniarek@gmail.com>2019-09-16 01:46:55 -0400
committerShaindel Schwartz <shaindel@google.com>2019-09-16 11:47:35 -0400
commitf2fb48c3b3d79a75a88a99fba6576b25d42ec528 (patch)
treee0e97e09100ca73573c192952ac5fb2a9194727c /googlemock/include/gmock/gmock-matchers.h
parentcad3bc46c2ba8ec0bd7bb252d7279fe791140fbf (diff)
downloadgoogletest-f2fb48c3b3d79a75a88a99fba6576b25d42ec528.tar.gz
googletest-f2fb48c3b3d79a75a88a99fba6576b25d42ec528.tar.bz2
googletest-f2fb48c3b3d79a75a88a99fba6576b25d42ec528.zip
Googletest export
Merge 3bdefdb473d304803d2a38e2a2cd5cdc1827c3bd into fb49e6c164490a227bbb7cf5223b846c836a0305 Closes #2407 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/googletest/pull/2407 from kuzkry:StaticAssertTypeEq 3bdefdb473d304803d2a38e2a2cd5cdc1827c3bd PiperOrigin-RevId: 269255328
Diffstat (limited to 'googlemock/include/gmock/gmock-matchers.h')
-rw-r--r--googlemock/include/gmock/gmock-matchers.h24
1 files changed, 12 insertions, 12 deletions
diff --git a/googlemock/include/gmock/gmock-matchers.h b/googlemock/include/gmock/gmock-matchers.h
index ad166875..bf9eb205 100644
--- a/googlemock/include/gmock/gmock-matchers.h
+++ b/googlemock/include/gmock/gmock-matchers.h
@@ -2068,15 +2068,15 @@ class ContainerEqMatcher {
typedef typename View::type StlContainer;
typedef typename View::const_reference StlContainerReference;
+ static_assert(!std::is_const<Container>::value,
+ "Container type must not be const");
+ static_assert(!std::is_reference<Container>::value,
+ "Container type must not be a reference");
+
// We make a copy of expected in case the elements in it are modified
// after this matcher is created.
explicit ContainerEqMatcher(const Container& expected)
- : expected_(View::Copy(expected)) {
- // Makes sure the user doesn't instantiate this class template
- // with a const or reference type.
- (void)testing::StaticAssertTypeEq<Container,
- GTEST_REMOVE_REFERENCE_AND_CONST_(Container)>();
- }
+ : expected_(View::Copy(expected)) {}
void DescribeTo(::std::ostream* os) const {
*os << "equals ";
@@ -2243,15 +2243,15 @@ class PointwiseMatcher {
typedef typename RhsView::type RhsStlContainer;
typedef typename RhsStlContainer::value_type RhsValue;
+ static_assert(!std::is_const<RhsContainer>::value,
+ "RhsContainer type must not be const");
+ static_assert(!std::is_reference<RhsContainer>::value,
+ "RhsContainer type must not be a reference");
+
// Like ContainerEq, we make a copy of rhs in case the elements in
// it are modified after this matcher is created.
PointwiseMatcher(const TupleMatcher& tuple_matcher, const RhsContainer& rhs)
- : tuple_matcher_(tuple_matcher), rhs_(RhsView::Copy(rhs)) {
- // Makes sure the user doesn't instantiate this class template
- // with a const or reference type.
- (void)testing::StaticAssertTypeEq<RhsContainer,
- GTEST_REMOVE_REFERENCE_AND_CONST_(RhsContainer)>();
- }
+ : tuple_matcher_(tuple_matcher), rhs_(RhsView::Copy(rhs)) {}
template <typename LhsContainer>
operator Matcher<LhsContainer>() const {