Skip to content

Commit

Permalink
COMP: Fixed link error with old versions of AppleClang
Browse files Browse the repository at this point in the history
eb8ce3c caused a link error with AppleClang 7 and 8.

It in turn was a follow up to:
af537fc and 1ad4e98

which were working around similar link errors with old versions of GCC.

Since using =default doesn't win us so much, just don't use it with any version of GCC/clang in these four cases.
  • Loading branch information
seanm committed May 9, 2020
1 parent bf8eab5 commit 1bb185a
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 10 deletions.
11 changes: 8 additions & 3 deletions Modules/Core/Common/include/itkQuadrilateralCell.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,15 @@ class ITK_TEMPLATE_EXPORT QuadrilateralCell
}
}

#if defined(__GNUC__) && (__GNUC__ > 5) || defined(__clang__)
~QuadrilateralCell() override = default;
#else
#if defined(__GNUC__)
// A bug in some versions of the GCC and Clang compilers
// result in an ICE or linker error when "= default" is requested.
// This was observed in at least gcc 4.8 and 5.4.0, and
// AppleClang 7.0.2 and 8.0.0. Probably others too.
// "= default" doesn't gain us much, so just don't use it here.
~QuadrilateralCell() override{};
#else
~QuadrilateralCell() override = default;
#endif

protected:
Expand Down
11 changes: 8 additions & 3 deletions Modules/Core/Common/include/itkTriangleCell.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,15 @@ class ITK_TEMPLATE_EXPORT TriangleCell
TriangleCell()
: m_PointIds(NumberOfPoints, NumericTraits<PointIdentifier>::max())
{}
#if defined(__GNUC__) && (__GNUC__ > 5) || defined(__clang__)
~TriangleCell() override = default;
#else
#if defined(__GNUC__)
// A bug in some versions of the GCC and Clang compilers
// result in an ICE or linker error when "= default" is requested.
// This was observed in at least gcc 4.8 and 5.4.0, and
// AppleClang 7.0.2 and 8.0.0. Probably others too.
// "= default" doesn't gain us much, so just don't use it here.
~TriangleCell() override{};
#else
~TriangleCell() override = default;
#endif

protected:
Expand Down
7 changes: 6 additions & 1 deletion Modules/Core/Transform/include/itkTransform.h
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,12 @@ class ITK_TEMPLATE_EXPORT Transform : public TransformBaseTemplate<TParametersVa

Transform();
Transform(NumberOfParametersType NumberOfParameters);
#if defined(__GNUC__) && __GNUC__ < 6 && !defined(__clang__)
#if defined(__GNUC__)
// A bug in some versions of the GCC and Clang compilers
// result in an ICE or linker error when "= default" is requested.
// This was observed in at least gcc 4.8 and 5.4.0, and
// AppleClang 7.0.2 and 8.0.0. Probably others too.
// "= default" doesn't gain us much, so just don't use it here.
~Transform() override{};
#else
~Transform() override = default;
Expand Down
9 changes: 6 additions & 3 deletions Modules/Core/Transform/include/itkTransformBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,12 @@ class TransformBaseTemplate : public Object
GetTransformCategory() const = 0;

protected:
#if defined(__GNUC__) && __GNUC__ < 6 && !defined(__clang__)
// A bug in some versions of the gcc 5.4.0 compiler
// result in a linker error when = default is requested
#if defined(__GNUC__)
// A bug in some versions of the GCC and Clang compilers
// result in an ICE or linker error when "= default" is requested.
// This was observed in at least gcc 4.8 and 5.4.0, and
// AppleClang 7.0.2 and 8.0.0. Probably others too.
// "= default" doesn't gain us much, so just don't use it here.
TransformBaseTemplate(){};
~TransformBaseTemplate() override{};
#else
Expand Down

0 comments on commit 1bb185a

Please sign in to comment.