Skip to content

Commit

Permalink
COMP: No longer delete (= delete) PreFillDirection() function template
Browse files Browse the repository at this point in the history
Pull request #2869
commit af32a77 ("COMP: Remove
unreachable code") "deleted" the `PreFillDirection()` function template
definition, by `= delete`. This appeared to cause compilation errors on
the following sites/builds:

  Site: RogueResearch7
  Build Name: Mac10.11-AppleClang-rel-x86_64-static
  Build Name: Mac10.11-AppleClang-dbg-x86_64-static

As reported by Jon Haitz Legarreta Gorroño at
#2869 (comment)

The error messages included:

    /Users/builder/externalModules/IO/NIFTI/test/itkNiftiImageIOTest.cxx:26:1: error: redefinition of 'PreFillDirection'
    PreFillDirection<1>()

The compilation error appears caused by Clang compiler issue "Bug 17537
- Explicit specialization of deleted function template not possible"
(https://bugs.llvm.org/show_bug.cgi?id=17537), reported by
jonathan.sauer, 2013-10-10, and fixed with Clang 3.9.

Worked around this compiler bug by removing `= delete`. Also removed the
declarations of the four `PreFillDirection()` specializations, as
suggested by Lee Newberg.
  • Loading branch information
N-Dekker authored and dzenanz committed Nov 19, 2021
1 parent 9273616 commit a328737
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions Modules/IO/NIFTI/test/itkNiftiImageIOTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,23 +54,10 @@ constexpr unsigned char LEFT = 128; /*Bit pattern 1 0 0 00000*/
constexpr unsigned char ANTERIOR = 64; /*Bit pattern 0 1 0 00000*/
constexpr unsigned char SUPERIOR = 32; /*Bit pattern 0 0 1 00000*/

// The only specializations of this function template that may be called are given below.
// Specializations of this function template are only implemented for 1D to 4D (defined in the cxx file).
template <unsigned int TDimension>
typename itk::ImageBase<TDimension>::DirectionType
PreFillDirection() = delete;

template <>
itk::ImageBase<1>::DirectionType
PreFillDirection<1>();
template <>
itk::ImageBase<2>::DirectionType
PreFillDirection<2>();
template <>
itk::ImageBase<3>::DirectionType
PreFillDirection<3>();
template <>
itk::ImageBase<4>::DirectionType
PreFillDirection<4>();
PreFillDirection();

template <typename T>
int
Expand Down

0 comments on commit a328737

Please sign in to comment.