From cdde6f508c502f8c051e23c7579f61b770117d5c Mon Sep 17 00:00:00 2001 From: Niels Dekker Date: Fri, 17 Sep 2021 18:21:35 +0200 Subject: [PATCH] COMP: Copy BSplineInterpolationWeightFunction::SupportSize within lambda Copied the constexpr static data member `SupportSize` to a local variable, to prevent Clang linker errors, like: > Undefined symbols for architecture x86_64: > "itk::BSplineInterpolationWeightFunction::SupportSize", referenced from: > itk::BSplineInterpolationWeightFunction::'lambda'()::operator()() const in itkBSplineInterpolationWeightFunctionTest.cxx.o From Mac10.13-AppleClang-dbg-x86_64-static, reported by Sean McBride. --- .../include/itkBSplineInterpolationWeightFunction.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Modules/Core/Common/include/itkBSplineInterpolationWeightFunction.h b/Modules/Core/Common/include/itkBSplineInterpolationWeightFunction.h index c997f1e038e..45731bd0ab4 100644 --- a/Modules/Core/Common/include/itkBSplineInterpolationWeightFunction.h +++ b/Modules/Core/Common/include/itkBSplineInterpolationWeightFunction.h @@ -123,9 +123,11 @@ class ITK_TEMPLATE_EXPORT BSplineInterpolationWeightFunction /** Table mapping linear offset to indices. */ const TableType m_OffsetToIndexTable{ [] { TableType table; - // Note: Copied the constexpr value `SupportSize` to a temporary, `SizeType{ SupportSize }`, to prevent a GCC - // (Ubuntu 7.5.0-3ubuntu1~18.04) link error, "undefined reference to `SupportSize`". - std::copy_n(ZeroBasedIndexRange(SizeType{ SupportSize }).cbegin(), NumberOfWeights, table.begin()); + // Note: Copied the constexpr value `SupportSize` to a local variable, to prevent a GCC + // (Ubuntu 7.5.0-3ubuntu1~18.04) link error, "undefined reference to `SupportSize`", and Clang + // (Mac10.13-AppleClang-dbg-x86_64-static) "Undefined symbols for architecture x86_64". + const auto supportSize = SupportSize; + std::copy_n(ZeroBasedIndexRange(supportSize).cbegin(), NumberOfWeights, table.begin()); return table; }() }; };