Difference in compiletime vs compiletime or compiler bug?

Adam D. Ruppe destructionator at gmail.com
Fri Dec 27 18:34:49 UTC 2019

On Friday, 27 December 2019 at 18:22:10 UTC, Sjoerd Nijboer wrote:
> When calling the mixin directly instead of through the template 
> mixin it breaks with thesame error message.

What exactly did you do here?

struct C
         static foreach (m; mixins)

works for me...

> I don't know if this an actual compiler bug or if this is me 
> not properly understanding D.

This is a case of the function hijacking rules biting you: 

template mixins take things in two different scopes:


creates two separate things that do not overload each other. You 
have to `alias name = xxx` twice in the same scope to merge them.

string mixin works differently, it doesn't produce a scope. In 
your case you probably just want to use string mixin and take the 
`mix` item out entirely.

But anyway the mixin results from the two things do NOT 
automatically merge whcih is what causes your errors.

More information about the Digitalmars-d-learn mailing list