diff --git a/deps/googletest/include/gtest/gtest-matchers.h b/deps/googletest/include/gtest/gtest-matchers.h index 08ffbeb93c976f..6d2ab14d2ad9bd 100644 --- a/deps/googletest/include/gtest/gtest-matchers.h +++ b/deps/googletest/include/gtest/gtest-matchers.h @@ -40,6 +40,7 @@ #define GOOGLETEST_INCLUDE_GTEST_GTEST_MATCHERS_H_ #include +#include #include #include #include @@ -485,6 +486,15 @@ class [[nodiscard]] Matcher : public internal::MatcherBase { // Implicit constructor here allows people to write // EXPECT_CALL(foo, Bar(5)) instead of EXPECT_CALL(foo, Bar(Eq(5))) sometimes Matcher(T value); // NOLINT + + // Implicit constructor here allows people to write + // EXPECT_THAT(foo, nullptr) instead of EXPECT_THAT(foo, IsNull()) for smart + // pointer types. + // + // The second argument is needed to avoid capturing literal '0'. + template + Matcher(U, // NOLINT + std::enable_if_t>* = nullptr); }; // The following two specializations allow the user to write str @@ -895,13 +905,21 @@ inline internal::EqMatcher Eq(T x) { return internal::EqMatcher(x); } -// Constructs a Matcher from a 'value' of type T. The constructed +// Constructs a Matcher from a 'value' of type T. The constructed // matcher matches any value that's equal to 'value'. template Matcher::Matcher(T value) { *this = Eq(value); } +// Constructs a Matcher from nullptr. The constructed matcher matches any +// value that is equal to nullptr. +template +template +Matcher::Matcher(U, std::enable_if_t>*) { + *this = Eq(nullptr); +} + // Creates a monomorphic matcher that matches anything with type Lhs // and equal to rhs. A user may need to use this instead of Eq(...) // in order to resolve an overloading ambiguity. diff --git a/deps/googletest/include/gtest/internal/gtest-port.h b/deps/googletest/include/gtest/internal/gtest-port.h index 69eaad10b1c311..fa11a391fe5c54 100644 --- a/deps/googletest/include/gtest/internal/gtest-port.h +++ b/deps/googletest/include/gtest/internal/gtest-port.h @@ -1452,7 +1452,7 @@ typedef GTestMutexLock MutexLock; // without knowing its type. class [[nodiscard]] ThreadLocalValueHolderBase { public: - virtual ~ThreadLocalValueHolderBase() {} + virtual ~ThreadLocalValueHolderBase() = default; }; // Provides a way for a thread to send notifications to a ThreadLocal @@ -1466,8 +1466,8 @@ class [[nodiscard]] ThreadLocalBase { virtual ThreadLocalValueHolderBase* NewValueForCurrentThread() const = 0; protected: - ThreadLocalBase() {} - virtual ~ThreadLocalBase() {} + ThreadLocalBase() = default; + virtual ~ThreadLocalBase() = default; private: ThreadLocalBase(const ThreadLocalBase&) = delete; @@ -1496,7 +1496,7 @@ class GTEST_API_ [[nodiscard]] ThreadWithParamBase { protected: class Runnable { public: - virtual ~Runnable() {} + virtual ~Runnable() = default; virtual void Run() = 0; }; @@ -1515,14 +1515,14 @@ class [[nodiscard]] ThreadWithParam : public ThreadWithParamBase { ThreadWithParam(UserThreadFunc* func, T param, Notification* thread_can_start) : ThreadWithParamBase(new RunnableImpl(func, param), thread_can_start) {} - virtual ~ThreadWithParam() {} + ~ThreadWithParam() override {} private: class RunnableImpl : public Runnable { public: RunnableImpl(UserThreadFunc* func, T param) : func_(func), param_(param) {} - virtual ~RunnableImpl() {} - virtual void Run() { func_(param_); } + ~RunnableImpl() override {} + void Run() override { func_(param_); } private: UserThreadFunc* const func_; @@ -1605,8 +1605,8 @@ class [[nodiscard]] ThreadLocal : public ThreadLocalBase { class ValueHolderFactory { public: - ValueHolderFactory() {} - virtual ~ValueHolderFactory() {} + ValueHolderFactory() = default; + virtual ~ValueHolderFactory() = default; virtual ValueHolder* MakeNewHolder() const = 0; private: @@ -1616,7 +1616,7 @@ class [[nodiscard]] ThreadLocal : public ThreadLocalBase { class DefaultValueHolderFactory : public ValueHolderFactory { public: - DefaultValueHolderFactory() {} + DefaultValueHolderFactory() = default; ValueHolder* MakeNewHolder() const override { return new ValueHolder(); } private: