On Tuesday, 18 December 2018 at 12:21:44 UTC, berni wrote:
Is there a way to check if a function is indeed executed at
compile time or not? (Other than going through the whole
executable binaries...)
I tried
static this()
{
if (__ctfe) pragma(msg,"works");
// some other stuff
}
but unfortunatley this "if" is also executed at compile time,
when I put it into a function that is only called at runtime.
When I try "static if" instead the compiler complains about
"__ctfe" being not known at compile time.
Why would you need to know?