Commit 81627c6
committed
COMP: Forward-declare itk::Indent in itkPrintHelper.h
itkPrintHelper.h is included from itkMacro.h. Common ITK headers include
itkIndent.h, which itself includes itkMacro.h, which transitively includes
itkPrintHelper.h. When itkIndent.h is the include-chain entry point, the
recursive inclusion of itkIndent.h from itkPrintHelper.h's prologue is a
header-guard no-op — class itk::Indent has NOT yet been declared at the
point itkPrintHelper.h is parsed.
Most toolchains tolerate this because the only reference to Indent in
this file is a function parameter declaration (`const Indent & indent`),
and many parsers accept forward use of an undeclared type at parse time.
Stricter configurations (Apple Clang dbg, AppleClang ASanUBSan, ClangMain,
TSan, gcc 11.4 TBB-Debug, MSVC 2022 Static-DebugTBB, Valgrind, Coverage)
reject it as:
itkPrintHelper.h:97:44: error: unknown type name 'Indent'
The fix is the same pattern already used a few lines above for NumericTraits:
add an explicit forward declaration of class Indent inside namespace itk
before the namespace itk::print_helper block. Every PrintNumericTrait()
call site already #includes itkIndent.h directly or transitively (they
need to stream `os << indent`), so the forward declaration is sufficient
for the template's parameter list to parse; the full Indent definition is
visible at every instantiation site.
Symptom across 8+ Nightly / Expected Nightly platforms (2026-05-11):
CE=1 / TF=0 / TN=~2660 — one compile error in ITKCommon blocks the
entire test grid.1 parent 59176b1 commit 81627c6
1 file changed
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
41 | 48 | | |
42 | 49 | | |
43 | 50 | | |
| |||
0 commit comments