Skip to content

COMP: Workaround Clang 3 error default initialization const MatrixGTest - #2472

Merged
thewtex merged 1 commit into
InsightSoftwareConsortium:masterfrom
N-Dekker:Workaround-Clang-3.8-error-default-initialization-const
Apr 1, 2021
Merged

COMP: Workaround Clang 3 error default initialization const MatrixGTest#2472
thewtex merged 1 commit into
InsightSoftwareConsortium:masterfrom
N-Dekker:Workaround-Clang-3.8-error-default-initialization-const

Conversation

@N-Dekker

Copy link
Copy Markdown
Contributor

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 (@jhlegarreta) at pull request
"ENH: Make itk::Matrix trivially copyable, following Rule of Zero"
#2449

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"
InsightSoftwareConsortium#2449

@dzenanz dzenanz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we could also drop clang 3.x with ITK 5.3?

@jhlegarreta

jhlegarreta commented Mar 31, 2021

Copy link
Copy Markdown
Member

Thanks for doing this @N-Dekker 💯. It is proving it hard to keep all compilers happy.

@thewtex
thewtex merged commit e9b8983 into InsightSoftwareConsortium:master Apr 1, 2021
@N-Dekker

N-Dekker commented Apr 1, 2021

Copy link
Copy Markdown
Contributor Author

It is proving it hard to keep all compilers happy.

Indeed, Jon! Apparently this particular const keyword made the old clang 3.x unhappy. While removing this const could cause a warning from Visual C++, when Code Analysis is enabled, saying something like:

warning C26496: The variable 'defaultConstructedMatrix' does not change after construction, mark it as const (con.4).

And I do think this warning is meaningful, so I'd rather keep the const keyword in there!

hjmjohnson pushed a commit to hjmjohnson/ITK that referenced this pull request May 6, 2026
…round-Clang-3.8-error-default-initialization-const

COMP: Workaround Clang 3 error default initialization const MatrixGTest
hjmjohnson pushed a commit to hjmjohnson/ITK that referenced this pull request May 12, 2026
…round-Clang-3.8-error-default-initialization-const

COMP: Workaround Clang 3 error default initialization const MatrixGTest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants