April 01, 2019
Hello,
Simple code:
> import std.stdio;
> 
> mixin template DeclFlag(alias values)
> {
>     static foreach(value; values)
>     {
>         mixin("bool has" ~ value ~ " = false;");
>     }
> }
> 
> enum Key : string
> {
>     First = "qwerty",
>     Last = "zaqy"
> }
> 
> void main()
> {
>     enum data = [Key.First, Key.Last];
>     mixin DeclFlag!(data);
> 
>     static foreach(value; data)
>     {
>         writeln(mixin("has" ~ value));
>     }
> }

The output is:
> true
> true

But in template mixin DeclFlag all variables are inited with "false" value!

Also with AST switch I get code where there aren't any lines with text "bool hasqwerty = false;" or "bool haszaqy = false;". What happens?
April 01, 2019
On 01.04.19 18:31, Andrey wrote:
> Also with AST switch I get code where there aren't any lines with text "bool hasqwerty = false;" or "bool haszaqy = false;". What happens?

Compiler bug. https://issues.dlang.org/show_bug.cgi?id=19479