COMP: Fix ill-formed std::abs<double> in ConditionalMedianImageFilter - #975
Merged
SimonRit merged 1 commit intoJul 23, 2026
Merged
Conversation
std::abs has no function-template overload accepting an explicit template argument, so std::abs<double>(x) is ill-formed and rejected as an ambiguous call by conforming compilers (e.g. Apple clang). Compute the difference in double and call the unambiguous std::abs(double) overload.
hjmjohnson
marked this pull request as ready for review
July 23, 2026 01:42
SimonRit
approved these changes
Jul 23, 2026
SimonRit
left a comment
Collaborator
There was a problem hiding this comment.
Thanks! I don't understand why we didn't detect this problem before.
hjmjohnson
added a commit
to InsightSoftwareConsortium/ITK
that referenced
this pull request
Jul 23, 2026
Update remote-module GIT_TAG pins to their upstream default-branch HEAD to reduce drift and pick up maintenance since the last bump. RTK, SphinxExamples, TubeTK, Cleaver, and TractographyTRX are left at their existing pins: RTK and TractographyTRX await upstream fixes (RTKConsortium/RTK#975, tee-ar-ex/ITKTractographyTRX#30), TubeTK has an upstream header/implementation mismatch, SphinxExamples is only verifiable via its standalone build, and Cleaver's bundled GoogleTest collides with ITK's when BUILD_TESTING is on. Verified by a clean Release build of the 8 buildable updated modules (zero build failures). CudaCommon, IOOpenSlide, and Ultrasound are advanced but only exercisable in CI (no CUDA / OpenSlide / a compatible VTK on the local macOS host).
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.
std::abshas no function-template overload that accepts an explicit template argument, sostd::abs<double>(x)is ill-formed. Conforming compilers (e.g. Apple clang) reject it as an ambiguous call, breaking any consumer that instantiatesConditionalMedianImageFilter. This computes the difference indoubleand calls the unambiguousstd::abs(double)overload.Context
Introduced by commit
3936486("COMP: Drop use of itk::Math::Absolute to fix compilation warnings"), which replaceditk::Math::Absolute(...)withstd::abs<double>(...). The surrounding arithmetic (sum,mean,stdev) is already computed indouble, so casting the pixel-difference todoubleand callingstd::abs(double)matches the intended semantics and remains warning-free.Discovered while building RTK as an ITK remote module with Apple clang, where every translation unit including
rtkConditionalMedianImageFilter.hxxfailed withcall to 'abs' is ambiguous. Verified locally: rebuilt RTK application/test targets with this change; the errors are cleared.