From d5ad28dbe14fca51038fb8c7610f11602b98f682 Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Wed, 20 Apr 2022 10:27:17 +0900 Subject: 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 7583660..3d3bea3 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 - 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)); } -- cgit v0.12