February 18, 2015
I'm developing an embedded DSL using CTFE. The DSL code is translated into D code and mixin-ed into the D code of user's application.  In order to provide meaningful error messages the DSL compiler always intercepts all errors in the DSL code and reports them at compile-time using pragma(msg, ...). The DSL compiler never generates incorrect D code to avoid reporting errors in the generated D code obscurely related to the original DSL code.  The problem is that the D compiler always exits as if the compilation was successful (for D compiler it is successful, since the generated D code is correct).

Is there any way to force the D compiler to fail compilation other than generating incorrect D code when translating erroneous DSL code?
February 18, 2015
On 2/18/15 12:43 PM, Dmitri Makarov wrote:
> I'm developing an embedded DSL using CTFE. The DSL code is translated
> into D code and mixin-ed into the D code of user's application.  In
> order to provide meaningful error messages the DSL compiler always
> intercepts all errors in the DSL code and reports them at compile-time
> using pragma(msg, ...). The DSL compiler never generates incorrect D
> code to avoid reporting errors in the generated D code obscurely related
> to the original DSL code.  The problem is that the D compiler always
> exits as if the compilation was successful (for D compiler it is
> successful, since the generated D code is correct).
>
> Is there any way to force the D compiler to fail compilation other than
> generating incorrect D code when translating erroneous DSL code?

static assert(0, message)

-Steve