Schrodinger's CTFE

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Wed Jul 15 22:44:24 UTC 2020


On 7/15/20 4:33 PM, Steven Schveighoffer wrote:
> 
> int foo(bool x)()
> {
>     if(x && (__ctfe || !__ctfe)) return 1;
>     return 2;
> }
> 
> I think this is a way to fix some of those static foreach loops with 
> returns which can have these reachability problems. Only, it's really 
> verbose and ugly. Maybe we still should have that other variable?

Would a function work?

@property
bool __schro() pure nothrow @nogc { return __ctfe || !__ctfe; }



More information about the Digitalmars-d mailing list