Skip to content

Commit 684d709

Browse files
yfeldblumfacebook-github-bot
authored andcommitted
fix violation of -Wshadow=compatible-local under gcc in UuidTest
Summary: `INSTANTIATE_TEST_SUITE_P` uses the name `info` in a way that would be shadowed by the lambda passed to `INSTANTIATE_TEST_SUITE_P` also using the name `info`. Issue reported to upstream gtest: google/googletest#4776. Repro: https://godbolt.org/z/65oz63933. Fixes the following build failure: ``` In file included from gtest/gtest.h:63, from folly/portability/GTest.h:27, from folly/codec/test/UuidTest.cpp:25: folly/codec/test/UuidTest.cpp: In lambda function: folly/codec/test/UuidTest.cpp:157:60: warning: declaration of ‘const testing::TestParamInfo<UuidParseTestParam>& info’ shadows a parameter [-Wshadow=compatible-local] 157 | [](const ::testing::TestParamInfo<UuidParseTestParam>& info) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~ folly/codec/test/UuidTest.cpp:153:1: note: shadowed declaration is here 153 | INSTANTIATE_TEST_SUITE_P( | ^~~~~~~~~~~~~~~~~~~~~~~~ folly/codec/test/UuidTest.cpp: In lambda function: folly/codec/test/UuidTest.cpp:220:60: warning: declaration of ‘const testing::TestParamInfo<UuidParseTestParam>& info’ shadows a parameter [-Wshadow=compatible-local] 220 | [](const ::testing::TestParamInfo<UuidParseTestParam>& info) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~ folly/codec/test/UuidTest.cpp:216:1: note: shadowed declaration is here 216 | INSTANTIATE_TEST_SUITE_P( | ^~~~~~~~~~~~~~~~~~~~~~~~ ``` Reviewed By: dmm-fb Differential Revision: D76616505 fbshipit-source-id: 021b2fb73ea27abad13e9f2c967ab9f824b984d9
1 parent 47c8a74 commit 684d709

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

third-party/folly/src/folly/codec/test/UuidTest.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,8 @@ INSTANTIATE_TEST_SUITE_P(
154154
UuidParsers,
155155
UuidParseTest,
156156
::testing::ValuesIn(getUuidParseTestParams()),
157-
[](const ::testing::TestParamInfo<UuidParseTestParam>& info) {
158-
return info.param.name;
157+
[](const ::testing::TestParamInfo<UuidParseTestParam>& info_) {
158+
return info_.param.name;
159159
});
160160

161161
// Additional tests for comparing implementations
@@ -217,7 +217,7 @@ INSTANTIATE_TEST_SUITE_P(
217217
SimdVsScalar,
218218
UuidParseComparisonTest,
219219
::testing::ValuesIn(getSimdParseFunctions()),
220-
[](const ::testing::TestParamInfo<UuidParseTestParam>& info) {
221-
return "CompareScalarTo" + info.param.name;
220+
[](const ::testing::TestParamInfo<UuidParseTestParam>& info_) {
221+
return "CompareScalarTo" + info_.param.name;
222222
});
223223
#endif

0 commit comments

Comments
 (0)