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

          Issue ID: 16548
           Summary: Shadowing a variable not detected when nesting foreach
                    with associative arrays
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: [email protected]
          Reporter: [email protected]

Reproduces on git HEAD.

This code:

void main()
{
    int[int] x;
    foreach (int a; x)
    {
        foreach (int a; x)
        {
        }
    }
}

should generate a compile error "variable a is shadowing variable a", but it
doesn't.

When using non-associative arrays, the error is generated properly.

--

Reply via email to