[Issue 20369] New: shadowed variable in foreach loop always considered "foreach variable"

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Nov 8 10:55:55 UTC 2019


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

          Issue ID: 20369
           Summary: shadowed variable in foreach loop always considered
                    "foreach variable"
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P3
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: r.sagitario at gmx.de

void foo()
{
    string[string] aa;
    string text;
    foreach(k, v; aa)
    {
       string text;
    }
}

onlineapp.d(7): Deprecation: variable text is shadowing variable
onlineapp.foo.text. Rename the foreach variable.

Note that a regular local variable is called "foreach variable".

--


More information about the Digitalmars-d-bugs mailing list