From b6de66819e1e7492075a5c74e438c3b1967ad3fb Mon Sep 17 00:00:00 2001 From: Vladislav Shchapov Date: Thu, 5 Sep 2024 15:38:07 +0500 Subject: [PATCH] Backport from GoogleTest: "Always initialize fields in MatcherBase constructors" (https://github.com/google/googletest/pull/3797) Signed-off-by: Vladislav Shchapov --- test/gtest/gtest/gtest.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/gtest/gtest/gtest.h b/test/gtest/gtest/gtest.h index 55a31d0a..cb994607 100644 --- a/test/gtest/gtest/gtest.h +++ b/test/gtest/gtest/gtest.h @@ -6390,17 +6390,18 @@ class MatcherBase : private MatcherDescriberInterface { } protected: - MatcherBase() : vtable_(nullptr) {} + MatcherBase() : vtable_(nullptr), buffer_() {} // Constructs a matcher from its implementation. template - explicit MatcherBase(const MatcherInterface* impl) { + explicit MatcherBase(const MatcherInterface* impl) + : vtable_(nullptr), buffer_() { Init(impl); } template ::type::is_gtest_matcher> - MatcherBase(M&& m) { // NOLINT + MatcherBase(M&& m) : vtable_(nullptr), buffer_() { // NOLINT Init(std::forward(m)); }