Skip to content

Commit

Permalink
COMP: Workaround Clang 3 error default initialization const MatrixGTest
Browse files Browse the repository at this point in the history
Worked around a compiler bug encountered with Clang 3.8.1 and
Mac10.10-AppleClang (which appears fixed with more recent Clang
compiler versions), saying:

> error: default initialization of an object of const type
> 'const itk::Matrix' without a user-provided default constructor

Reported by Jon Haitz Legarreta Gorroño at pull request
"ENH: Make itk::Matrix trivially copyable, following Rule of Zero"
#2449
  • Loading branch information
N-Dekker committed Mar 31, 2021
1 parent d785555 commit 874f51d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Modules/Core/Common/test/itkMatrixGTest.cxx
Expand Up @@ -28,7 +28,15 @@ template <typename TMatrix>
void
Expect_Matrix_default_constructor_zero_initializes_all_elements()
{
const TMatrix defaultConstructedMatrix;
#ifndef __clang__
// Clang versions before 3.9.0 reject the `const` here (erroneously).
// Mac10.10-AppleClang-dbg-x86_64-static produced an error message on an
// attempt to build ITK 5 from the master branch (2021-03-31), saying:
// > error: default initialization of an object of const type
// > 'const itk::Matrix' without a user-provided default constructor
const
#endif
TMatrix defaultConstructedMatrix;

for (unsigned row{}; row < TMatrix::RowDimensions; ++row)
{
Expand Down

0 comments on commit 874f51d

Please sign in to comment.