The function 'foo' is not a valid constant function error occurs only in large builds

In reply to Mark Curry:

I am the other engineer working on this. I have tried using different methods for the ‘for’ loop, foreach, for(;;), and all produce the same results.

I haven’t tried using a hardcoded loop count. Could be worth a shot.

The automatic tag was also an attempt to get this to compile. It made no difference whether it was there or not.