"Martin Nowak"  wrote in message news:[email protected]...

On 10/08/2014 10:01 PM, Andrei Alexandrescu wrote:
>
> That's a bummer. Can we get the compiler to remove the "if (__ctfe)"
> code after semantic checking?
>
> Andrei

It seems that __ctfe is treated as constant in the backend.
> At least there is no asm code generated for these examples (even without
-O).

     void main()
     {
         import std.stdio;
         if (__ctfe)
             writeln("foo");
     }

     int main() { return __ctfe ? 1 : 0; }

__ctfe is passed to the backend as 'false', and even with -O the basic optimizations will strip it as dead code. So it is removed after semantic checking, but that doesn't help as semantic checking includes @nogc checking.

Reply via email to