[Issue 2195] Variable shadowing in foreach is not detected and reported

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Aug 24 02:46:07 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=2195


Michal Minich <michal.minich at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |michal.minich at gmail.com


--- Comment #7 from Michal Minich <michal.minich at gmail.com> 2012-08-24 02:46:04 PDT ---
DMD 2.060

Similar case, where the variable is declared as foreach type list identifier

module main;
int global;
int main (string[] args)
{
    // int global = 10; // Error: shadowing declaration main.main.global 
                        // is deprecate .. ok
    foreach (global, item; [1, 2, 3]) // no error reported here for global .. 
                                      // but expected
        {}
    writeln(global); // prints 0
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list