@bellenot On a Linux (x86_64) machine, when trying the test.cc example with “commented lines”, ROOT 6.36.04 and 6.34.10 show the same problem as reported. ROOT 6.32.18 dies with a segmentation violation. ROOT 6.30.08 and older (e.g., 6.28.12) report and “error: expected unqualified-id” (for the “for” loop).
@preimer It seems to me that you are trying to create/use a so-called “unnamed macro”.
In this case, you need to “encapsulate” the whole source code in a {...} block.
So, in your test.cc example, replace the line:
int test() {
With a simple line:
{
I also recall that many older ROOT versions required the very first line of an “unnamed macro” file to be the “{” line (so, do not add any “comment lines”, or any preprocessor directives, right in the beginning of your macro file; add them after the initial “{” line, if needed).
Be also aware that there are known problems with “unnamed macros” in ROOT 6, e.g., the “return” from it is broken (reported in 2018, still unsolved in 2025).