On Monday, 3 September 2018 at 13:52:24 UTC, bauss wrote:
On Monday, 3 September 2018 at 13:39:25 UTC, agorkvmh wrote:
[...]

It prints 1, because pragma(msg) is called when the compiler is analyzing the code through the semantic process and not when the body of the function is executed during CTFE.

And since "pos = pos+1" is a runtime construct (technically) then the expression is ignored, unless the function is called during CTFE, but by the time the function is called during CTFE then the pragma(msg) has already been executed.

Thank you for your quick answer.

There is a way to do print the two values at compile time?
What's the best way to debug a CTFE function?


Reply via email to