Why do ints defined in template mixins have garbage values?

Kagamin spam at here.lot
Wed Dec 12 15:22:53 UTC 2018


On Tuesday, 11 December 2018 at 21:19:59 UTC, Steven 
Schveighoffer wrote:
> If I add an int using a regular declaration or a straight 
> mixin("int i0 = 5;"); then the variable shows up.

mixin template genInts()
{
     enum arr = [0];
     static foreach (t; arr)
     {
         mixin("int i0 = 5;");
     }
}

Still prints garbage.


More information about the Digitalmars-d-learn mailing list