[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:07:06 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=10619

--- Comment #2 from hsteoh at quickfur.ath.cx ---
A slightly simpler test case:
-----
import std.stdio;

void myFunc(alias Sym)()
{
        writefln("%s", Sym);
}

void main()
{
        {
                {
                        int x = 789;
                        myFunc!x();
                }

                int x = 456;
                myFunc!x();
        }

        int x = 123;
        myFunc!x();
}
-----

Expected output:
-----
789
456
123
-----

Actual output:
-----
789
789
789
-----

--


More information about the Digitalmars-d-bugs mailing list