mirror of
https://github.com/google/googletest.git
synced 2026-07-30 16:26:24 +08:00
Fixes -Wtautological-pointer-compare in gmock-matchers
PiperOrigin-RevId: 948667420 Change-Id: Ibb35d7e6469a193607a72f10377ef3a494f9525f
This commit is contained in:
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"; }
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user