COMP: Skip fpclassify for integral vnl_math classification predicates#9
Draft
hjmjohnson wants to merge 1 commit into
Draft
COMP: Skip fpclassify for integral vnl_math classification predicates#9hjmjohnson wants to merge 1 commit into
hjmjohnson wants to merge 1 commit into
Conversation
numeric_predicates::isfinite/isnan/isinf/isnormal forwarded std::isfinite(arg) etc. for every TArg. For integral TArg this instantiates the Windows UCRT <corecrt_math.h> integer template, where fpclassify(<integral>) is an ambiguous call (error C2668) on some MSVC toolsets, so vnl_matrix/vnl_vector of an integer type fail to compile. Short-circuit integral arguments with if constexpr: an integer is always finite, never inf/NaN, and normal when non-zero.
Member
Author
|
Downstream consumer: InsightSoftwareConsortium/ITK#6451 carries this same change as an ITK-local patch to its vendored |
dzenanz
approved these changes
Jun 16, 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.
Skip
fpclassifyfor integralvnl_mathclassification predicates so integer-typedvnl_matrix/vnl_vectorcompile on MSVC toolsets wherefpclassify(<integral>)is ambiguous.Root cause
numeric_predicates::isfinite/isnan/isinf/isnormalforwardstd::isfinite(arg)(etc.) for everyTArg. For integralTArgthis instantiates the Windows UCRT<corecrt_math.h>integer templatewhere
fpclassify(<integral>)is an ambiguous call (error C2668:float/double/long double) on e.g. MSVC 14.38.33130 (cl 19.38) + Windows SDK ≤ 10.0.22621. Every integer-typedvnl_matrix/vnl_vectorTU fails to compile; newer toolsets (MSVC 14.44) are unaffected.Fix: short-circuit integral arguments with
if constexpr— an integer is always finite, never inf/NaN, normal when non-zero — avoiding the ambiguous SDK template.Validation
The equivalent change applied to ITK's vendored copy of this file builds all of ITK (3396/3396 targets, 0 errors) on the failing toolchain (MSVC 14.38.33130, Windows SDK 10.0.22621.0). Carried as ITK PR InsightSoftwareConsortium/ITK#6451 pending this upstream fix.
AI assistance
fpclassifyinteger template, authored theif constexprguard, validated via a full ITK build.