static assert(0) in template is a disaster

Stefan Koch uplink.coder at googlemail.com
Wed Jun 17 09:34:02 UTC 2020


On Wednesday, 17 June 2020 at 07:05:25 UTC, Timon Gehr wrote:
> On 17.06.20 03:26, Andrei Alexandrescu wrote:
>> [...]
>
> Not exactly as there is a clear ordering of declarations. 
> Rather, it's a self-contradicting program, like this one:
>
> static if(!is(typeof(x))) int x;
>
> This would be an example of a race condition:
>
> static if(!is(typeof(x))) int y;
> static if(!is(typeof(y))) int x;
>
>> [...]
>
> Unfortunately, if dependency structures get a bit tricky, DMD 
> will fail to correctly compile even well-formed programs. It's 
> why I have refrained from going too crazy with metaprogramming 
> after my experience with my D frontend that stopped compiling 
> after DMD 2.060. (Ironically, it does produce a diagnostic for 
> each of the examples discussed here.)

What classifies as D code as ill-defined?

Could you post some examples?

Greetings,
Stefan


More information about the Digitalmars-d mailing list