assert(__ctfe) and betterC

Steven Schveighoffer schveiguy at gmail.com
Wed Jan 27 20:59:24 UTC 2021


CTFE is the primary vehicle used to generate dynamic mixin code based on 
template and regular parameters. Doing it with templates *only* is 
possible, but so so painful.

But, the general mechanisms used in CTFE to generate string data (i.e. 
string concatenation) are not available for betterC runtime code. And 
CTFE must be compiled to as runtime code before it is interpreted.

I remember something about assert(__ctfe) in your function telling the 
compiler to not emit the code to the object file. Did that get in? Is 
there a way we can use that to turn off betterC too?

Otherwise, you get errors when building your CTFE function because 
"TypeInfo cannot be used with -betterC"

Is there another way I can do this?

-Steve


More information about the Digitalmars-d mailing list