Battle-plan for CTFE

David Nadlinger via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Thu Sep 1 15:11:45 PDT 2016


On Thursday, 1 September 2016 at 21:48:41 UTC, Rory McGuire wrote:
> 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.

As a general comment, there is no such thing as a CTFE phase. It 
is performed in-line with other semantic analysis as required.

> __traits(compiles, _some_function_that_calls_), thinks that the 
> invalid code compiles even when it doesn't compile […]

No, you are missing the point. This:

---
void foo() {
   @#$!
}
---

will always cause a compiler error, regardless of whether there 
is a `__traits(compiles, foo())` somewhere else in the module. 
__traits(compiles, …) only applies to its argument and doesn't 
magically cause errors in code somewhere else to be ignored.

  — David


More information about the Digitalmars-d-announce mailing list