Skip to content

Commit 0f5134c

Browse files
committed
COMP: Fix unused-lambda-capture statement
lambda capture 'n' is not required to be captured for this use [-Wunused-lambda-capture]
1 parent 4f4fde0 commit 0f5134c

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

Modules/Core/Common/test/itkImageBufferRangeGTest.cxx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -664,10 +664,10 @@ TEST(ImageBufferRange, IteratorsSupportRandomAccess)
664664

665665
{
666666
// Expression to be tested: 'r += n'
667-
difference_type const n = 3;
667+
constexpr difference_type n = 3;
668668

669669
r = initialIterator;
670-
const auto expectedResult = [&r, n] {
670+
const auto expectedResult = [&r] {
671671
// Operational semantics, as specified by the C++11 Standard:
672672
difference_type m = n;
673673
if (m >= 0)
@@ -685,12 +685,12 @@ TEST(ImageBufferRange, IteratorsSupportRandomAccess)
685685
}
686686
{
687687
// Expressions to be tested: 'a + n' and 'n + a'
688-
difference_type const n = 3;
688+
constexpr difference_type n = 3;
689689

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, n] {
693+
const auto expectedResult = [a] {
694694
// Operational semantics, as specified by the C++11 Standard:
695695
X tmp = a;
696696
return tmp += n;
@@ -701,10 +701,10 @@ TEST(ImageBufferRange, IteratorsSupportRandomAccess)
701701
}
702702
{
703703
// Expression to be tested: 'r -= n'
704-
difference_type const n = 3;
704+
constexpr difference_type n = 3;
705705

706706
r = initialIterator;
707-
const auto expectedResult = [&r, n] {
707+
const auto expectedResult = [&r] {
708708
// Operational semantics, as specified by the C++11 Standard:
709709
return r += -n;
710710
}();
@@ -715,11 +715,11 @@ TEST(ImageBufferRange, IteratorsSupportRandomAccess)
715715
}
716716
{
717717
// Expression to be tested: 'a - n'
718-
difference_type const n = -3;
718+
constexpr difference_type n = -3;
719719

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

722-
const auto expectedResult = [a, n] {
722+
const auto expectedResult = [a] {
723723
// Operational semantics, as specified by the C++11 Standard:
724724
X tmp = a;
725725
return tmp -= n;
@@ -737,7 +737,7 @@ TEST(ImageBufferRange, IteratorsSupportRandomAccess)
737737
}
738738
{
739739
// Expression to be tested: 'a[n]'
740-
difference_type const n = 3;
740+
constexpr difference_type n = 3;
741741
static_assert(std::is_convertible_v<decltype(a[n]), reference>, "Return type tested");
742742
EXPECT_EQ(a[n], *(a + n));
743743
}

Modules/Core/Common/test/itkShapedImageNeighborhoodRangeGTest.cxx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,7 @@ TEST(ShapedImageNeighborhoodRange, IteratorsSupportRandomAccess)
775775
static_assert(std::is_same_v<decltype(r += n), X &>, "Return type tested");
776776

777777
r = initialIterator;
778-
const auto expectedResult = [&r, n] {
778+
const auto expectedResult = [&r] {
779779
// Operational semantics, as specified by the C++11 Standard:
780780
difference_type m = n;
781781
if (m >= 0)
@@ -792,12 +792,12 @@ TEST(ShapedImageNeighborhoodRange, IteratorsSupportRandomAccess)
792792
}
793793
{
794794
// Expressions to be tested: 'a + n' and 'n + a'
795-
difference_type const n = 3;
795+
constexpr difference_type n = 3;
796796

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, n] {
800+
const auto expectedResult = [a] {
801801
// Operational semantics, as specified by the C++11 Standard:
802802
X tmp = a;
803803
return tmp += n;
@@ -808,12 +808,12 @@ TEST(ShapedImageNeighborhoodRange, IteratorsSupportRandomAccess)
808808
}
809809
{
810810
// Expression to be tested: 'r -= n'
811-
difference_type const n = 3;
811+
constexpr difference_type n = 3;
812812

813813
static_assert(std::is_same_v<decltype(r -= n), X &>, "Return type tested");
814814

815815
r = initialIterator;
816-
const auto expectedResult = [&r, n] {
816+
const auto expectedResult = [&r] {
817817
// Operational semantics, as specified by the C++11 Standard:
818818
return r += -n;
819819
}();
@@ -823,11 +823,11 @@ TEST(ShapedImageNeighborhoodRange, IteratorsSupportRandomAccess)
823823
}
824824
{
825825
// Expression to be tested: 'a - n'
826-
difference_type const n = -3;
826+
constexpr difference_type n = -3;
827827

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

830-
const auto expectedResult = [a, n] {
830+
const auto expectedResult = [a] {
831831
// Operational semantics, as specified by the C++11 Standard:
832832
X tmp = a;
833833
return tmp -= n;
@@ -839,7 +839,7 @@ TEST(ShapedImageNeighborhoodRange, IteratorsSupportRandomAccess)
839839
// Expression to be tested: 'b - a'
840840
static_assert(std::is_same_v<decltype(b - a), difference_type>, "Return type tested");
841841

842-
difference_type const n = b - a;
842+
const difference_type n = b - a;
843843
EXPECT_TRUE(a + n == b);
844844
EXPECT_TRUE(b == a + (b - a));
845845
}

0 commit comments

Comments
 (0)