Fixes -Wtautological-pointer-compare in gmock-matchers
PiperOrigin-RevId: 948667420 Change-Id: Ibb35d7e6469a193607a72f10377ef3a494f9525f
This commit is contained in:
committed by
Copybara-Service
parent
b973ccb9ab
commit
a25f43576e
@@ -821,7 +821,11 @@ class [[nodiscard]] IsNullMatcher {
|
|||||||
template <typename Pointer>
|
template <typename Pointer>
|
||||||
bool MatchAndExplain(const Pointer& p,
|
bool MatchAndExplain(const Pointer& p,
|
||||||
MatchResultListener* /* listener */) const {
|
MatchResultListener* /* listener */) const {
|
||||||
return p == nullptr;
|
if constexpr (std::is_function_v<Pointer>) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return p == nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DescribeTo(::std::ostream* os) const { *os << "is NULL"; }
|
void DescribeTo(::std::ostream* os) const { *os << "is NULL"; }
|
||||||
@@ -835,7 +839,11 @@ class [[nodiscard]] NotNullMatcher {
|
|||||||
template <typename Pointer>
|
template <typename Pointer>
|
||||||
bool MatchAndExplain(const Pointer& p,
|
bool MatchAndExplain(const Pointer& p,
|
||||||
MatchResultListener* /* listener */) const {
|
MatchResultListener* /* listener */) const {
|
||||||
return p != nullptr;
|
if constexpr (std::is_function_v<Pointer>) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return p != nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DescribeTo(::std::ostream* os) const { *os << "isn't NULL"; }
|
void DescribeTo(::std::ostream* os) const { *os << "isn't NULL"; }
|
||||||
|
|||||||
Reference in New Issue
Block a user