[Issue 22138] New: foreach cannot declare the loop variables as scope

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jul 23 21:01:43 UTC 2021


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

          Issue ID: 22138
           Summary: foreach cannot declare the loop variables as scope
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: bugzilla at digitalmars.com

The following fails to compile:

 void test() {
    int[] a;
    foreach (scope e; a)
    {
    }
 }

but ref, enum, alias, const, immutable, shared, and inout work.

--


More information about the Digitalmars-d-bugs mailing list