From 4ae270979823394bdba49f67792fbecbc7366daf Mon Sep 17 00:00:00 2001 From: John Law Date: Sun, 21 Jun 2026 17:09:29 +0100 Subject: [PATCH] Initialize `match` variable in `MatchAndExplain`'s loop of gmock-matchers.h This prevents the warning of `variable 'match' is not initialized [cppcoreguidelines-init-variables]`. --- googlemock/include/gmock/gmock-matchers.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/googlemock/include/gmock/gmock-matchers.h b/googlemock/include/gmock/gmock-matchers.h index 5cfa0b71c..76ace8bfe 100644 --- a/googlemock/include/gmock/gmock-matchers.h +++ b/googlemock/include/gmock/gmock-matchers.h @@ -3696,7 +3696,7 @@ class [[nodiscard]] ElementsAreMatcherImpl // the end of either the elements or the matchers, or until we find a // mismatch. for (; it != stl_container.end() && exam_pos != count(); ++it, ++exam_pos) { - bool match; // Does the current element match the current matcher? + bool match = false; // Does the current element match the current matcher? if (listener_interested) { StringMatchResultListener s; match = matchers_[exam_pos].MatchAndExplain(*it, &s);