[Issue 10619] Out-of-scope variable in a nested scope shadowed by subsequent variable in outer scope
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Wed Jul 16 10:32:07 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=10619
--- Comment #3 from hsteoh at quickfur.ath.cx ---
A clearly legal case that's currently broken:
----
import std.stdio;
void myFunc(alias Sym)()
{
writeln(Sym);
}
void main()
{
foreach (i; 0..3) {
myFunc!i();
}
foreach (i; 5..8) {
myFunc!i();
}
}
----
Expected output:
----
0
1
2
5
6
7
----
Actual output:
----
0
1
2
2
2
2
----
The two instances of 'i' are clearly in distinct scopes, yet they are conflated
in the mangling of myFunc, leading to wrong generated code.
--
More information about the Digitalmars-d-bugs
mailing list