www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21272] New: Overzealous and inconsistent foreach shadowing


          Issue ID: 21272
           Summary: Overzealous and inconsistent foreach shadowing
                    deprecations for nested functions
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: rejects-valid
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: dlang-bugzilla thecybershadow.net

////////////////// test.d //////////////////
void fun()
    int var1, var2, var3;

    void gun()
        int var1; // OK?

        int[] arr;
        foreach (i, var2; arr) {} // OK?

        int[int] aa;
        foreach (k, var3; aa) {} // Not OK??

Introduced in https://github.com/dlang/dmd/pull/10404

Sep 23 2020