Skip to content

COMP: Apply rule of zero to LogicOpBase#6664

Merged
hjmjohnson merged 1 commit into
InsightSoftwareConsortium:mainfrom
hjmjohnson:fix-logicops-deprecated-copy
Jul 20, 2026
Merged

COMP: Apply rule of zero to LogicOpBase#6664
hjmjohnson merged 1 commit into
InsightSoftwareConsortium:mainfrom
hjmjohnson:fix-logicops-deprecated-copy

Conversation

@hjmjohnson

@hjmjohnson hjmjohnson commented Jul 18, 2026

Copy link
Copy Markdown
Member

Remove the defaulted destructor from LogicOpBase so the implicit copy and move members come back, silencing the last -Wdeprecated-copy-with-dtor warning on the nightly dashboards.

Follows #6592, which applied the same rule-of-zero treatment to MaskInput, SimilarPixelsFunctor, and SimilarVectorsFunctor. #6538 covers the two remaining files, where the classes have virtual destructors and ITK_DEFAULT_COPY_AND_MOVE remains the right fix.

The warning

LogicOpBase declared ~LogicOpBase() = default; and nothing else, so the implicit copy members were deprecated:

Modules/Filtering/ImageIntensity/include/itkLogicOpsFunctors.h:66:3: warning:
  definition of implicit copy constructor for 'LogicOpBase<float, float, unsigned char>'
  is deprecated because it has a user-declared destructor [-Wdeprecated-copy-with-dtor]

Modules/Filtering/ImageIntensity/include/itkLogicOpsFunctors.h:66:3: warning:
  definition of implicit copy assignment operator for ... [-Wdeprecated-copy-with-dtor]

One declaration accounted for the whole functor family — Equal, NotEqual, Greater, GreaterEqual, Less, LessEqual, and NOT all derive from LogicOpBase.

The destructor was non-virtual, nothing deletes through a LogicOpBase*, and both members are trivially copyable, so removing it is behavior-preserving. It had also been suppressing move construction and assignment outright, so removing it restores all four special members rather than the two that warned.

Distribution of the flag across the nightly builds, for reference:

File Warnings Covered by
itkDefaultVectorPixelAccessor.h 81 #6538
itkPriorityQueueContainer.h 30 #6538
itkLogicOpsFunctors.h 1 this PR
Verification

Compiled a probe exercising copy-construct, copy-assign, move-construct, and move-assign on Equal<float, float, unsigned char> and NOT, against the real include set of a configured build tree:

Compiler / flag Before After
clang++ 18.1.3, -Wdeprecated-copy-with-dtor 2 0
g++ 13.3.0, -Wdeprecated-copy-dtor 0 0

The two "before" diagnostics are exactly the copy-constructor and copy-assignment warnings quoted above. g++ reports nothing either way — this is a clang-only diagnostic, consistent with it surfacing on the AppleClang nightlies. The move lines in the probe compile after the change, confirming the moves the destructor had suppressed are back.

Full rebuild (Linux x86_64, GCC 13.3.0, Release): 4148 of 4148 edges built, no errors, and itkLogicOpsFunctors.h appears zero times in the build log, so nothing downstream is disturbed. pre-commit run --all-files passes.

@github-actions github-actions Bot added type:Compiler Compiler support or related warnings area:Filtering Issues affecting the Filtering module labels Jul 18, 2026
The defaulted destructor deprecated the implicit copy members and
suppressed the move members outright. It is non-virtual and both
members are trivially copyable, so removing it restores all four
and silences -Wdeprecated-copy-with-dtor.

Follows InsightSoftwareConsortium#6592.
@hjmjohnson
hjmjohnson force-pushed the fix-logicops-deprecated-copy branch from db3dd3c to 86d62a7 Compare July 19, 2026 13:25
@hjmjohnson hjmjohnson changed the title COMP: Default the copy and move members of LogicOpBase COMP: Apply rule of zero to LogicOpBase Jul 19, 2026
@hjmjohnson
hjmjohnson marked this pull request as ready for review July 19, 2026 13:30
@greptile-apps

greptile-apps Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR removes an explicitly defaulted destructor from LogicOpBase. The main changes are:

  • Restores implicit copy and move special members for the logic functor base.
  • Keeps the existing foreground and background value behavior unchanged.
  • Addresses the -Wdeprecated-copy-with-dtor warning for the image-intensity logic functor family.

Confidence Score: 5/5

Safe to merge with minimal risk.

The change is narrowly scoped to removing a defaulted non-virtual destructor from a small value-based functor base. Runtime logic and stored foreground/background values are unchanged.

No files require special attention.

T-Rex T-Rex Logs

What T-Rex did

  • Generated the logic-functor copy/move/use probe for Equal and NOT.
  • Inspected tool availability; tool-check.log shows the required tools are unavailable for the preferred validation path.
  • Tried configuring the build with CMake, but the configured build tree could not be produced (EXIT_CODE: 127).
  • Ran probe compilation attempts; the closest attempts failed on missing generated headers rather than on the logic functor code.

View all artifacts

T-Rex Ran code and verified through T-Rex

Important Files Changed

Filename Overview
Modules/Filtering/ImageIntensity/include/itkLogicOpsFunctors.h Removes the explicitly defaulted non-virtual LogicOpBase destructor so copy and move special members are implicitly generated again; no functional issues found.

Reviews (1): Last reviewed commit: "COMP: Apply rule of zero to LogicOpBase" | Re-trigger Greptile

@hjmjohnson
hjmjohnson merged commit 46bd839 into InsightSoftwareConsortium:main Jul 20, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:Filtering Issues affecting the Filtering module type:Compiler Compiler support or related warnings

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants