Fix -Wshadow warnings

../googlemock/test/gmock-actions_test.cc:687:36: warning: declaration of ‘v’ shadows a member of ‘testing::{anonymous}::ReturnTest_SupportsReferenceLikeReturnType_Test::TestBody()::Result’ [-Wshadow]
  687 |     Result(const std::vector<int>& v) : v(&v) {}  // NOLINT
      |            ~~~~~~~~~~~~~~~~~~~~~~~~^
../googlemock/test/gmock-actions_test.cc:686:29: note: shadowed declaration is here
  686 |     const std::vector<int>* v;
      |                             ^

../googlemock/test/gmock-actions_test.cc: In constructor ‘testing::{anonymous}::ReturnTest_PrefersConversionOperator_Test::TestBody()::Out::Out(int)’:
../googlemock/test/gmock-actions_test.cc:720:28: warning: declaration of ‘x’ shadows a member of ‘testing::{anonymous}::ReturnTest_PrefersConversionOperator_Test::TestBody()::Out’ [-Wshadow]
  720 |     explicit Out(const int x) : x(x) {}
      |                  ~~~~~~~~~~^
../googlemock/test/gmock-actions_test.cc:718:9: note: shadowed declaration is here
  718 |     int x;
      |         ^

PiperOrigin-RevId: 501580618
Change-Id: I584710fbbe440ec724f88746e51f3be5653c32d5
This commit is contained in:
Tom Hughes 2023-01-12 09:03:40 -08:00 committed by Copybara-Service
parent b5401fef68
commit 356fc30125

View File

@ -684,7 +684,7 @@ TEST(ReturnTest, SupportsReferenceLikeReturnType) {
// A reference wrapper for std::vector<int>, implicitly convertible from it. // A reference wrapper for std::vector<int>, implicitly convertible from it.
struct Result { struct Result {
const std::vector<int>* v; const std::vector<int>* v;
Result(const std::vector<int>& v) : v(&v) {} // NOLINT Result(const std::vector<int>& vec) : v(&vec) {} // NOLINT
}; };
// Set up an action for a mock function that returns the reference wrapper // Set up an action for a mock function that returns the reference wrapper
@ -717,7 +717,7 @@ TEST(ReturnTest, PrefersConversionOperator) {
struct Out { struct Out {
int x; int x;
explicit Out(const int x) : x(x) {} explicit Out(const int val) : x(val) {}
explicit Out(const In&) : x(0) {} explicit Out(const In&) : x(0) {}
}; };