On Thu, Sep 1, 2016 at 11:05 PM, David Nadlinger via Digitalmars-d-announce <digitalmars-d-announce@puremagic.com> wrote:
> On Thursday, 1 September 2016 at 21:01:46 UTC, Rory McGuire wrote: > >> I'm actually asking why we can't catch the ctfe error. >> > > You can, by using __traits(compiles, …). > > Surely the ctfe engine could be changed to catch unsupported code errors. >> (Not invalid, just unsupported at CT). >> > > It already does, see above. How is this related to try/catch? > > — David > I was hoping that the error was coming from the CTFE engine as it ran the code, but it comes up before ctfe execution I guess. __traits(compiles, _some_function_that_calls_), thinks that the invalid code compiles even when it doesn't compile, e.g.: template assertCTFE(bool b) { enum assertCTFE = __traits(compiles, _checkCTFE1()); } void _checkCTFE1() { static if (__ctfe) { // this still stops compilation (probably because this is checked before __traits(compiled ...) is evaluated } }