On Tuesday, 30 August 2016 at 22:01:45 UTC, tsbockman wrote:
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`.

Sorry. It I overlooked a something rather important. static __ctfe is currently not possible and it's rather expensive to make it possible.

Reply via email to