COMP: Spell out Montage AllPeakInterpolationMethods return type#6653
Merged
hjmjohnson merged 1 commit intoJul 16, 2026
Merged
Conversation
igenerator cannot resolve a deduced return type and emits the literal "?unknown?" into itkPhaseCorrelationOptimizer.i, which swig rejects with a syntax error, failing the itkTileMontage wrapping target on every Python build. Naming the std::array type keeps the initializer_list lifetime fix and lets igenerator emit a wrappable declaration.
hjmjohnson
marked this pull request as ready for review
July 16, 2026 14:21
hjmjohnson
commented
Jul 16, 2026
hjmjohnson
left a comment
Member
Author
There was a problem hiding this comment.
I over optimized to use "auto" so that future changes were easier (remove magic parameter 4), but swig got confused. This is still an easy fix as compiler error will aleart if the return array has a different size than 4, so a quickly exposed issue.
Contributor
|
| Filename | Overview |
|---|---|
| Modules/Registration/Montage/include/itkPhaseCorrelationOptimizer.h | Replaces the deduced return type with the equivalent explicit std::array type for wrapper generation. |
Reviews (1): Last reviewed commit: "COMP: Spell out Montage AllPeakInterpola..." | Re-trigger Greptile
dzenanz
approved these changes
Jul 16, 2026
hjmjohnson
merged commit Jul 16, 2026
becca0f
into
InsightSoftwareConsortium:main
20 of 21 checks passed
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.
igeneratorcannot resolve a deduced return type: it emits the literal?unknown?intoitkPhaseCorrelationOptimizer.i, which swig then rejects, failing theitkTileMontagewrapping target on all three Python builds. Spelling out thestd::arraytype restores wrapping and keeps the-Winit-list-lifetimefix from 6f0a280 intact.Companion to #6652: the two together account for every build error on the current nightly dashboard (this one the 3 Python builds, #6652 the 6 macOS dbg builds). They are independent — no merge ordering required.
Failing builds (Nightly 20260716-0100)
MacOS-Rel-PythonUbuntu-22.04-gcc11.4-Rel-PythonWindows11-VS22x64-Release-PythonReproduces identically on macOS, Linux and Windows, so it is source rather than toolchain. The failure appeared with the first nightly after 6f0a280 (2026-07-15) landed.
Root cause
6f0a280 fixed a genuine
-Winit-list-lifetimedefect by returning astd::arrayby value instead of astd::initializer_listwhose backing array did not outlive the return. In doing so it also changed the return type to a deduced one:igeneratorcannot name that type, and emits it literally. Line 249 of the generateditkPhaseCorrelationOptimizer.i:swig fails on the
?. Naming the type makesigeneratoremit a declaration it can wrap:The lifetime fix is unaffected — the array is still returned by value. Only the return type is spelled out.
Local validation
Generated the real
.i(castxml + igenerator) and ran the exact swig invocation and version CI uses (4.4.1, fetched viaITK_SWIG_VERSION), with CI's full flag set including-Werror:itkPhaseCorrelationOptimizer.i:249: Error: Syntax error in input(3).?unknown?is gone; swig exits 0 onitkPhaseCorrelationOptimizer.iand, more importantly, onitkTileMontage.i— the target CI actually fails on.itkPhaseCorrelationOptimizer.cxx.ocompiles with 0 errors and 0 warnings, so the-Winit-list-lifetimefix still holds.pre-commit run --all-filesexits 0.Note on wrapping-visible signatures
A deduced return type on a wrapped public API silently degrades to
?unknown?rather than failing loudly at the point of authorship, and swig only rejects it later while wrapping an unrelated class that imports the header.AllPeakInterpolationMethods()currently has no live callers — the three references initkMontageTestHelper.hxxanditkPairwiseTestHelper.hxxare commented out — so the construct was not exercised by anything except the wrapping pass.AI assistance
.ito identify the?unknown?emission after an initial hypothesis (swig cannot parseconstexpr auto) failed to reproduce the reported syntax error against swig 4.4.1