Skip to content

Commit 514ff3c

Browse files
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 514ff3c

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

Modules/Core/Common/include/itkPrintHelper.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ namespace itk
3838
// sites already #include "itkNumericTraits.h" directly or transitively.
3939
template <typename T>
4040
class NumericTraits;
41+
// Same circular-include guard as NumericTraits<T> above.
42+
class Indent;
4143
} // namespace itk
4244

4345
namespace itk::print_helper

0 commit comments

Comments
 (0)