digitalmars.D.bugs - [Issue 19479] New: ints defined in template mixins have garbage values
- d-bugmail puremagic.com (40/40) Dec 11 2018 https://issues.dlang.org/show_bug.cgi?id=19479
https://issues.dlang.org/show_bug.cgi?id=19479 Issue ID: 19479 Summary: ints defined in template mixins have garbage values Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: johannes.riecken gmail.com Code: import std.conv; import std.stdio; mixin template genInts() { enum arr = [0,1]; static foreach (t; arr) { mixin("int i" ~ to!string(t) ~ " = 5;"); } } void main() { mixin genInts!(); writeln(i0); writeln(i1); } Expected output: 5 5 Actual output is two garbage integer values. $ dmd --version DMD64 D Compiler v2.083.0 Copyright (C) 1999-2018 by The D Language Foundation, All Rights Reserved written by Walter Bright $ uname -a x86_64 GNU/Linux --
Dec 11 2018