The rule right now is that a function is called at comptime implicitly only when you’re already in a comptime context, otherwise it will need to be prefixed with comptime
. There has been discussion about eventually have the compiler “try” to resolve function calls at comptime without explicitly asking for it, but none of that exists today.
So a function call in the top scope of a file is always comptime, while a function call inside main is always at runtime unless prefixed with comptime
.
Not sure how that interacts with LLVM optimizations though, so you might get a non-comptime compile time resolution by LLVM when the function is simple enough.