COMP: Fix ill-formed std::abs<double> in ConditionalMedianImageFilter#975
Open
hjmjohnson wants to merge 1 commit into
Open
COMP: Fix ill-formed std::abs<double> in ConditionalMedianImageFilter#975hjmjohnson wants to merge 1 commit into
hjmjohnson wants to merge 1 commit into
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
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.