On Monday, 29 August 2016 at 08:39:56 UTC, Stefan Koch wrote:
I just came up with a nifty little patch that makes it possible to ensure that a function is _only_ used at ctfe.
Or the opposite.

static assert(__ctfe, "This function is not supposed to be called outside of ctfe"); and static assert(!__ctfe, "This function is not supposed to be called during ctfe");

similarly you can use static if (__ctfe).

Is it worth trying to get it into master ?

Yes, please. I've often wished I could use `__ctfe` in a `static if`.

Reply via email to