Battle-plan for CTFE

ag0aep6g via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Thu Sep 1 14:26:31 PDT 2016


On 09/01/2016 11:01 PM, Rory McGuire via Digitalmars-d-announce wrote:
> I'm actually asking why we can't catch the ctfe error.

There is no CTFE error in your example. It doesn't compile in the first 
place, even without attempting any CTFE.

[...]
> Surely the ctfe engine could be changed to catch unsupported code
> errors. (Not invalid, just unsupported at CT).

Maybe. It isn't obvious to me that it would be a good idea, but it's not 
obviously terrible either.

> The ctfe engine would have to "go past" the try anyway, right? This is
> the part I don't understand. Is it because ctfe actually hasn't started
> yet and some other analysis is freaking out?

It's just a compiler error. The snippet on its own fails compilation and 
there is no CTFE in there. Something like `static assert(_checkCTFE());` 
would involve CTFE. But that's not needed to trigger the error.


More information about the Digitalmars-d-announce mailing list