How did g4tools build successfully before 11.3?

Geant4 Version: 10.7.4, 11.0.1, 11.2.1
Operating System: macOS Tahoe
Compiler/Version: Apple clang version 17.0.0
CMake Version: 4.2.1


So I’m trying to rebuild my Geant4 installation, and move forward to G4 11, on my new MacBook Pro (macOS Tahoe, etc.). I’ve reported other problems which are likely my fault elsewhere, but this looks like something weird within G4. My 10.7.4 compilation failed with a complaint about wroot/columns.icc, and I’m seeing the identical error in the source code in 11.0.1 and 11.2.1:

/Applications/GEANT4/geant4.11.0.1/source/externals/g4tools/include/tools/wroot/columns.icc:402:22: error: no member named 'm_barnch' in 'std_vector_column_ref<T>'; did you mean 'm_branch'?
  402 |     ,m_branch(a_from.m_barnch)
      |                      ^~~~~~~~
      |                      m_branch

That is obviously a typo. I fixed it by hand in 10.7.4, but it seems to still be present up through 11.2. It’s fixed in 11.3.2, and presumably after that. But how did any of those releases build successfully in the first place?

Is there some sort of flag I’m supposed to have been setting to just never compile g4tools?

This seems to have come with more recent versions of clang that appear to require strict parsing even if the code is never used. I think that it worked before because this code was never actually used (*) but now clang (possibly also most recent GCCs but I haven’t tried) seem to be stricter about this. You’re right it should not compile!

(*) We’re in the process of a major simplification of g4tools to remove the dead code to avoid this type of issue in the future.

That’s what I thought also, but the columns.icc file is pulled in by G4RootAnalysisManager.cc, so it does get compiled. Is your point that the particular constructors with this bug weren’t referenced in that .cc file, and the older compilers were smart enough to ignore the unused block of code? That’s somewhat impressive, I guess.

Yes, I think it’s that that particular constructor was never used, so compilers ignored it - but don’t quote me on that!