Request for Comment assert(__ctfe)

Stefan Koch uplink.coder at gmail.com
Sun Apr 5 14:01:57 UTC 2020


On Sunday, 5 April 2020 at 13:54:19 UTC, tsbockman wrote:
> On Sunday, 5 April 2020 at 12:11:23 UTC, Stefan Koch wrote:
>> They only downside to this, is that giving assert(__ctfe) the 
>> special meaning to skip codegen might be confusing to some 
>> people .... then again you wouldn't use assert(__ctfe) unless 
>> you expect that function to not be available at run-time
>>
>> What do you guys think?
>
> Ideally it should only skip codegen if there are no statements 
> with side-effects before the assert(__ctfe). However, I think 
> it's fine to do it your way if that's easier to implement in 
> the compiler, as long as normal code gen and optimization is 
> still enabled for functions containing this construct, as a 
> workaround:
>
> if(!__ctfe) assert(0);

So it's much easier to just scan for assert(__ctfe);

I've just implemented it and the projects on the dlang buildkite 
are green.



More information about the Digitalmars-d mailing list