From ec2677f5a59f9078d728cdb5efeff431e3d52ee8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20Haitz=20Legarreta=20Gorro=C3=B1o?= Date: Mon, 29 Apr 2024 18:43:11 -0400 Subject: [PATCH] COMP: Use `default` copy and move construct and assign in `itk::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 --- Modules/Core/Common/include/itkRegion.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Modules/Core/Common/include/itkRegion.h b/Modules/Core/Common/include/itkRegion.h index 4e92c0a40a7..5231d02f3f9 100644 --- a/Modules/Core/Common/include/itkRegion.h +++ b/Modules/Core/Common/include/itkRegion.h @@ -90,6 +90,13 @@ class ITKCommon_EXPORT Region Region() = default; virtual ~Region() = default; + Region(const Region &) = default; + Region & + operator=(const Region &) = default; + Region(Region &&) = default; + Region & + operator=(Region &&) = default; + protected: /** Methods invoked by Print() to print information about the object * including superclasses. Typically not called by the user (use Print()