diff options
author | Mike Hommey <mhommey@mozilla.com> | 2022-04-20 04:27:17 +0300 |
---|---|---|
committer | Mike Hommey <mh@glandium.org> | 2022-04-20 04:42:11 +0300 |
commit | d5ad28dbe14fca51038fb8c7610f11602b98f682 (patch) | |
tree | 50c12a95f9689c230033d52a7ec2c32a3300220b | |
parent | 8ccdb9d56d07b9169ecd17f1164f251a637c250e (diff) |
Always initialize fields in MatcherBase constructors
This fixes -Wuninitialized warnings with GCC.
Fixes #3514.
-rw-r--r-- | googletest/include/gtest/gtest-matchers.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/googletest/include/gtest/gtest-matchers.h b/googletest/include/gtest/gtest-matchers.h index 75836605..3d3bea31 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)); } |