@ctfeonly

ketmar ketmar at ketmar.no-ip.org
Fri Dec 8 03:59:08 UTC 2017


ketmar wrote:

> still, why `__ctfe` was designed as variable, and not as `enum ctfe = 
> <bool>;`?

ah, sorry, i remembered. that was stupid question.

the rationale is: `static if` and `static assert` are processed *before* 
CTFE phase. i.e. CTFE interpreter never sees them, and cannot do the 
choice. and on semantic analysis phase it is not known yet if the code is 
for CTFE or not. that is, to allow `static assert(__ctfe)` to work, the 
whole semantic phase must be redesigned.


More information about the Digitalmars-d mailing list