diff options
author | Mike Hommey <mhommey@mozilla.com> | 2022-04-20 01:27:17 (GMT) |
---|---|---|
committer | Mike Hommey <mh@glandium.org> | 2022-04-20 01:42:11 (GMT) |
commit | d5ad28dbe14fca51038fb8c7610f11602b98f682 (patch) | |
tree | 50c12a95f9689c230033d52a7ec2c32a3300220b | |
parent | 8ccdb9d56d07b9169ecd17f1164f251a637c250e (diff) | |
download | googletest-d5ad28dbe14fca51038fb8c7610f11602b98f682.zip googletest-d5ad28dbe14fca51038fb8c7610f11602b98f682.tar.gz googletest-d5ad28dbe14fca51038fb8c7610f11602b98f682.tar.bz2 |
Always initialize fields in MatcherBase constructorsrefs/pull/3797/head
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 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 <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)); } |