COMP: Use default copy and move construct and assign in itk::Region#4627
Merged
jhlegarreta merged 1 commit intoInsightSoftwareConsortium:masterfrom May 2, 2024
Conversation
Member
Author
|
@seanm Hopefully this will remove some of the 199 warnings on RogueResearch22. |
Contributor
|
Cool, thanks! I defer to C++ experts on the correctness of this change, but seems reasonable to me! |
Contributor
|
I'm sorry I think
It's a bit cumbersome, but I guess the warnings will go away by adding four of those "explicitly defaulted" member functions to the public section: |
43ad378 to
7eba4b2
Compare
Member
Author
|
#4627 (comment) 👍 Done. Thanks Niels. |
7eba4b2 to
40830f7
Compare
ITK_DISALLOW_COPY_AND_MOVE in itk::Regionitk::Region
Use the compiler-proved default implementations for `itk::Region` copy
constructor, copy assignment, move constructor, and move assignment
functions.
As noted in [1], the C++ standard deprecated the implicit generation of
copy and assignment operators.
Fixes:
```
[CTest: warning matched] /Users/builder/externalModules/Core/Common/include/itkRegion.h:91:11:
warning: definition of implicit copy assignment operator for 'Region' is deprecated because it has a user-declared destructor [-Wdeprecated]
virtual ~Region() = default;
^
[CTest: warning matched] /Users/builder/externalModules/Core/Common/include/itkImageIORegion.h:117:30:
note: in implicit copy assignment operator for 'itk::Region' first required here
operator=(Self &&) = default;
^
[CTest: warning matched] /Users/builder/externalModules/IO/ImageBase/include/itkImageIOBase.h:228:3:
note: in implicit move assignment operator for 'itk::ImageIORegion' first required here
itkSetMacro(IORegion, ImageIORegion);
^
[CTest: warning matched] /Users/builder/externalModules/Core/Common/include/itkMacro.h:992:22:
note: expanded from macro 'itkSetMacro'
this->m_##name = std::move(_arg); \
^
```
And other similar warnings stemming from `itk::Region` that have been
appearing consistently in some macOS site builds in the dashboard:
https://open.cdash.org/viewBuildError.php?type=1&buildid=9579479
[1] https://learn.microsoft.com/bs-latn-ba/cpp/error-messages/compiler-warnings/c5267?view=msvc-150#remarks
40830f7 to
ec2677f
Compare
Member
Author
|
/azp run ITK.Windows |
N-Dekker
approved these changes
May 1, 2024
Contributor
N-Dekker
left a comment
There was a problem hiding this comment.
Does it indeed fix the warnings? I guess so, but you never know... anyway, approved, of course. 👍 Thanks Jon!
dzenanz
reviewed
May 1, 2024
thewtex
approved these changes
May 1, 2024
This was referenced May 2, 2024
N-Dekker
added a commit
to N-Dekker/ITK
that referenced
this pull request
May 8, 2024
Instead of "manually" defaulting their copy and move member functions. Follow-up to two commits by Jon Haitz Legarreta Gorroño: pull request InsightSoftwareConsortium#4626 commit 9aff210 "COMP: Use default copy, move for construc, assign `RealTimeStamp`" pull request InsightSoftwareConsortium#4627 commit ec2677f "COMP: Use `default` copy and move construct and assign in `itk::Region`"
N-Dekker
added a commit
to N-Dekker/ITK
that referenced
this pull request
May 13, 2024
Instead of "manually" defaulting their copy and move member functions. Follow-up to two commits by Jon Haitz Legarreta Gorroño: pull request InsightSoftwareConsortium#4626 commit 9aff210 "COMP: Use default copy, move for construc, assign `RealTimeStamp`" pull request InsightSoftwareConsortium#4627 commit ec2677f "COMP: Use `default` copy and move construct and assign in `itk::Region`"
hjmjohnson
pushed a commit
that referenced
this pull request
May 15, 2024
Instead of "manually" defaulting their copy and move member functions. Follow-up to two commits by Jon Haitz Legarreta Gorroño: pull request #4626 commit 9aff210 "COMP: Use default copy, move for construc, assign `RealTimeStamp`" pull request #4627 commit ec2677f "COMP: Use `default` copy and move construct and assign in `itk::Region`"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Use the compiler-proved default implementations for
itk::Regioncopy constructor, copy assignment, move constructor, and move assignment functions.As noted in [1], the C++ standard deprecated the implicit generation of copy and assignment operators.
Fixes:
And other similar warnings stemming from
itk::Regionthat have been appearing consistently in some macOS site builds in the dashboard: https://open.cdash.org/viewBuildError.php?type=1&buildid=9579479[1] https://learn.microsoft.com/bs-latn-ba/cpp/error-messages/compiler-warnings/c5267?view=msvc-150#remarks
PR Checklist