From 990f5d5d79d79d9cc069f564200d77b53cef4823 Mon Sep 17 00:00:00 2001 From: Niels Dekker Date: Tue, 13 Nov 2018 11:34:04 +0100 Subject: [PATCH] COMP: Fixed IndexRange warnings -Wshadow -Wmissing-field-initializers Fixed two types of warnings from Linux-x86_64-gcc4.8-m32: itkIndexRange.h:298:5: warning: declaration of 'size' shadows a member of 'this' [-Wshadow] itkIndexRangeGTest.cxx: warning: missing initializer for member 'itk::Index<2u>::m_InternalArray' [-Wmissing-field-initializers] Reported by Hans J Johnson @hjmjohnson --- Modules/Core/Common/include/itkIndexRange.h | 4 ++-- Modules/Core/Common/test/itkIndexRangeGTest.cxx | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Modules/Core/Common/include/itkIndexRange.h b/Modules/Core/Common/include/itkIndexRange.h index cab30acb746..e07399b3e93 100644 --- a/Modules/Core/Common/include/itkIndexRange.h +++ b/Modules/Core/Common/include/itkIndexRange.h @@ -294,12 +294,12 @@ class IndexRange final /** Constructs a range of indices for the specified grid size. */ - explicit IndexRange(const SizeType& size) + explicit IndexRange(const SizeType& gridSize) : // Note: Use parentheses instead of curly braces to initialize data members, // to avoid AppleClang 6.0.0.6000056 compile errors, "no viable conversion..." m_MinIndex(), - m_MaxIndex(CalculateMaxIndex({}, size)) + m_MaxIndex(CalculateMaxIndex({}, gridSize)) { } diff --git a/Modules/Core/Common/test/itkIndexRangeGTest.cxx b/Modules/Core/Common/test/itkIndexRangeGTest.cxx index a0ae0028850..ef8d9937eb6 100644 --- a/Modules/Core/Common/test/itkIndexRangeGTest.cxx +++ b/Modules/Core/Common/test/itkIndexRangeGTest.cxx @@ -140,7 +140,7 @@ TEST(IndexRange, IteratorsCanBePassedToStdForEach) std::for_each(range.begin(), range.end(), [](const IndexType index) { - EXPECT_TRUE(index >= IndexType{}); + EXPECT_TRUE(index >= IndexType()); }); } @@ -155,7 +155,7 @@ TEST(IndexRange, CanBeUsedAsExpressionOfRangeBasedForLoop) for (auto&& index : range) { - EXPECT_TRUE(index >= IndexType{}); + EXPECT_TRUE(index >= IndexType()); } }