On Thursday, 2 October 2014 at 17:56:29 UTC, AsmMan wrote:
I'd like to check if a function got CTFE, ie, the compiler was able to replace my foo(s); by the computed value at compile-time.

You have to explicitly force ctfe with context, it is never done automatically, and if it fails, the build will fail and you get a compile time error.

So if you write

enum f = foo();

or

static f = foo();

or similar initializations and the build succeeds, you know it got ctfe'd. Otherwise, it wasn't.

Reply via email to