Always initialize fields in MatcherBase constructors
This fixes -Wuninitialized warnings with GCC. Fixes #3514.
This commit is contained in:
parent
8ccdb9d56d
commit
d5ad28dbe1
@ -299,17 +299,18 @@ class MatcherBase : private MatcherDescriberInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
MatcherBase() : vtable_(nullptr) {}
|
MatcherBase() : vtable_(nullptr), buffer_() {}
|
||||||
|
|
||||||
// Constructs a matcher from its implementation.
|
// Constructs a matcher from its implementation.
|
||||||
template <typename U>
|
template <typename U>
|
||||||
explicit MatcherBase(const MatcherInterface<U>* impl) {
|
explicit MatcherBase(const MatcherInterface<U>* impl)
|
||||||
|
: vtable_(nullptr), buffer_() {
|
||||||
Init(impl);
|
Init(impl);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename M, typename = typename std::remove_reference<
|
template <typename M, typename = typename std::remove_reference<
|
||||||
M>::type::is_gtest_matcher>
|
M>::type::is_gtest_matcher>
|
||||||
MatcherBase(M&& m) { // NOLINT
|
MatcherBase(M&& m) : vtable_(nullptr), buffer_() { // NOLINT
|
||||||
Init(std::forward<M>(m));
|
Init(std::forward<M>(m));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user