Skip to content

Commit

Permalink
Backport from GoogleTest: "Always initialize fields in MatcherBase co…
Browse files Browse the repository at this point in the history
…nstructors" (google/googletest#3797)

Signed-off-by: Vladislav Shchapov <[email protected]>
  • Loading branch information
phprus committed Sep 5, 2024
1 parent 96da83d commit 48555d8
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions test/gtest/gtest/gtest.h
Original file line number Diff line number Diff line change
Expand Up @@ -6390,17 +6390,18 @@ class MatcherBase : private MatcherDescriberInterface {
}

protected:
MatcherBase() : vtable_(nullptr) {}
MatcherBase() : vtable_(nullptr), buffer_() {}

// Constructs a matcher from its implementation.
template <typename U>
explicit MatcherBase(const MatcherInterface<U>* impl) {
explicit MatcherBase(const MatcherInterface<U>* impl)
: vtable_(nullptr), buffer_() {
Init(impl);
}

template <typename M, typename = typename std::remove_reference<
M>::type::is_gtest_matcher>
MatcherBase(M&& m) { // NOLINT
MatcherBase(M&& m) : vtable_(nullptr), buffer_() { // NOLINT
Init(std::forward<M>(m));
}

Expand Down

0 comments on commit 48555d8

Please sign in to comment.