COMP: Fix deprecated-copy-with-dtor via rule of zero + rule of five (cf. #6538)#6670
Merged
hjmjohnson merged 1 commit intoJul 21, 2026
Conversation
hjmjohnson
marked this pull request as ready for review
July 21, 2026 14:54
Member
Author
Related work — this continues an established rule-of-zero campaignThis PR isn't a one-off: it's the next step in a consistent, already-merged effort to clear the Timeline
The 2024 Net: #6538 and this PR fix the same 33 warnings; merging this one keeps the codebase aligned with the #5849 / #6592 / #6664 precedent (less code, no macro). Only one of the two is needed. |
This comment was marked as resolved.
This comment was marked as resolved.
Remove the user-declared defaulted destructors from the value/leaf classes (DefaultVectorPixelAccessor, Min/MaxPriorityQueueElementWrapper) so the compiler synthesizes their special members. Keep the virtual destructor on the polymorphic extension-point bases (ElementWrapperInterface, ElementWrapperPointerInterface) and declare copy/move with ITK_DEFAULT_COPY_AND_MOVE so polymorphic destruction through the base pointer is preserved. Silences -Wdeprecated-copy-with-dtor (Apple Clang) on all five classes.
hjmjohnson
force-pushed
the
comp-rule-of-zero-dtor-6538
branch
from
July 21, 2026 15:27
861780c to
c24ab3c
Compare
dzenanz
approved these changes
Jul 21, 2026
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.
Silences all
-Wdeprecated-copy-with-dtorwarnings on fiveCore/Commonclasses, choosing the fix per class kind: rule of zero for the value/leaf types, rule of five for the polymorphic bases. Compare with #6538 (rule of five for all five).DefaultVectorPixelAccessor~=default(rule of zero)MinPriorityQueueElementWrapper~=default(rule of zero)MaxPriorityQueueElementWrapper~=default(rule of zero)ElementWrapperInterfacevirtual ~=default+ITK_DEFAULT_COPY_AND_MOVEElementWrapperPointerInterfacevirtual ~=default+ITK_DEFAULT_COPY_AND_MOVEWhy the two treatments
ElementWrapperInterface/ElementWrapperPointerInterfaceare documented public extension points ("you can use this wrapper … it follows the ElementWrapperInterface and thus can be used in the queue") with virtual members. Removing their virtual destructor would breakdeletethroughElementWrapperInterface*for downstream custom wrappers (C++ Core Guideline C.35) — so those keep the virtual destructor and getITK_DEFAULT_COPY_AND_MOVE(same as #6538). The three value/leaf classes are never a polymorphic-delete base, so rule of zero is safe and lighter.This split was prompted by a Greptile P1 on an earlier revision that removed the interface virtual destructors; see the resolved thread.
Warnings fixed (CDash build 11383687, Mac14.x-AppleClang-dbg)
Fixes all 33 ITK-proper
-Wdeprecated-copy-with-dtorwarnings (28DefaultVectorPixelAccessor, 4Min, 2ElementWrapperInterface, 1Max). The only 2 remaining of this type areThirdParty/GDCM/gdcmFile.h(vendored upstream), which #6538 also excludes.Local validation
deleteof a custom wrapper throughElementWrapperInterface*runs the derived destructor (count = 1).pre-commit run --all-filesclean.Relative to #6538: identical on the two interfaces (virtual dtor +
ITK_DEFAULT_COPY_AND_MOVE), differs only on the three value/leaf classes (rule of zero vs the macro). The two PRs touch the same lines, so only one should merge. Follows #6664 (rule of zero forLogicOpBase) and #5849 (rule of zero forNthElementPixelAccessor).