From d5ad28dbe14fca51038fb8c7610f11602b98f682 Mon Sep 17 00:00:00 2001
From: Mike Hommey <mhommey@mozilla.com>
Date: Wed, 20 Apr 2022 10:27:17 +0900
Subject: [PATCH] Always initialize fields in MatcherBase constructors

This fixes -Wuninitialized warnings with GCC.

Fixes #3514.
---
 googletest/include/gtest/gtest-matchers.h | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/googletest/include/gtest/gtest-matchers.h b/googletest/include/gtest/gtest-matchers.h
index 758366052..3d3bea319 100644
--- a/googletest/include/gtest/gtest-matchers.h
+++ b/googletest/include/gtest/gtest-matchers.h
@@ -299,17 +299,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));
   }