Skip to content

Commit b044168

Browse files
committed
COMP: Fix linux compilation warning
Modules/Core/Common/test/itkImageBufferRangeGTest.cxx: In lambda function: Modules/Core/Common/test/itkImageBufferRangeGTest.cxx:670:61: warning: declaration of 'n' shadows a previous local [-Wshadow] 670 | const auto expectedResult = [&r](const difference_type n) { | ^ Modules/Core/Common/test/itkImageBufferRangeGTest.cxx:667:31: note: shadowed declaration is here 667 | constexpr difference_type n = 3; | ^ Modules/Core/Common/test/itkImageBufferRangeGTest.cxx: In lambda function:
1 parent bea8688 commit b044168

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

Modules/Core/Common/test/itkImageBufferRangeGTest.cxx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -667,9 +667,9 @@ TEST(ImageBufferRange, IteratorsSupportRandomAccess)
667667
constexpr difference_type n = 3;
668668

669669
r = initialIterator;
670-
const auto expectedResult = [&r](const difference_type n) {
670+
const auto expectedResult = [&r](const difference_type nn) {
671671
// Operational semantics, as specified by the C++11 Standard:
672-
difference_type m = n;
672+
difference_type m = nn;
673673
if (m >= 0)
674674
while (m--)
675675
++r;
@@ -690,10 +690,10 @@ TEST(ImageBufferRange, IteratorsSupportRandomAccess)
690690
static_assert(std::is_same_v<decltype(a + n), X>, "Return type tested");
691691
static_assert(std::is_same_v<decltype(n + a), X>, "Return type tested");
692692

693-
const auto expectedResult = [a](const difference_type n) {
693+
const auto expectedResult = [a](const difference_type nn) {
694694
// Operational semantics, as specified by the C++11 Standard:
695695
X tmp = a;
696-
return tmp += n;
696+
return tmp += nn;
697697
}(n);
698698

699699
EXPECT_EQ(a + n, expectedResult);
@@ -704,9 +704,9 @@ TEST(ImageBufferRange, IteratorsSupportRandomAccess)
704704
constexpr difference_type n = 3;
705705

706706
r = initialIterator;
707-
const auto expectedResult = [&r](const difference_type n) {
707+
const auto expectedResult = [&r](const difference_type nn) {
708708
// Operational semantics, as specified by the C++11 Standard:
709-
return r += -n;
709+
return r += -nn;
710710
}(n);
711711
r = initialIterator;
712712
auto && actualResult = r -= n;
@@ -719,10 +719,10 @@ TEST(ImageBufferRange, IteratorsSupportRandomAccess)
719719

720720
static_assert(std::is_same_v<decltype(a - n), X>, "Return type tested");
721721

722-
const auto expectedResult = [a](const difference_type n) {
722+
const auto expectedResult = [a](const difference_type nn) {
723723
// Operational semantics, as specified by the C++11 Standard:
724724
X tmp = a;
725-
return tmp -= n;
725+
return tmp -= nn;
726726
}(n);
727727

728728
EXPECT_EQ(a - n, expectedResult);

Modules/Core/Common/test/itkShapedImageNeighborhoodRangeGTest.cxx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -797,10 +797,10 @@ TEST(ShapedImageNeighborhoodRange, IteratorsSupportRandomAccess)
797797
static_assert(std::is_same_v<decltype(a + n), X>, "Return type tested");
798798
static_assert(std::is_same_v<decltype(n + a), X>, "Return type tested");
799799

800-
const auto expectedResult = [a](const difference_type n) {
800+
const auto expectedResult = [a](const difference_type nn) {
801801
// Operational semantics, as specified by the C++11 Standard:
802802
X tmp = a;
803-
return tmp += n;
803+
return tmp += nn;
804804
}(n);
805805

806806
EXPECT_EQ(a + n, expectedResult);
@@ -813,9 +813,9 @@ TEST(ShapedImageNeighborhoodRange, IteratorsSupportRandomAccess)
813813
static_assert(std::is_same_v<decltype(r -= n), X &>, "Return type tested");
814814

815815
r = initialIterator;
816-
const auto expectedResult = [&r](const difference_type n) {
816+
const auto expectedResult = [&r](const difference_type nn) {
817817
// Operational semantics, as specified by the C++11 Standard:
818-
return r += -n;
818+
return r += -nn;
819819
}(n);
820820
r = initialIterator;
821821
const auto actualResult = r -= n;
@@ -827,10 +827,10 @@ TEST(ShapedImageNeighborhoodRange, IteratorsSupportRandomAccess)
827827

828828
static_assert(std::is_same_v<decltype(a - n), X>, "Return type tested");
829829

830-
const auto expectedResult = [a](const difference_type n) {
830+
const auto expectedResult = [a](const difference_type nn) {
831831
// Operational semantics, as specified by the C++11 Standard:
832832
X tmp = a;
833-
return tmp -= n;
833+
return tmp -= nn;
834834
}(n);
835835

836836
EXPECT_EQ(a - n, expectedResult);

0 commit comments

Comments
 (0)