[Issue 20067] New: [REG2.086] foreach no longer works on range with alias front

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jul 21 13:33:29 UTC 2019


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

          Issue ID: 20067
           Summary: [REG2.086] foreach no longer works on range with alias
                    front
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: johanengelen at weka.io

The following code compiled with DMD 2.061-2.085, but no longer compiles since
DMD 2.086:

```
struct S1
{
    int i;
    @property int ii();
    @property bool empty();
    alias front = ii;
    void popFront();
}
struct S2
{
    @property int i();
    @property bool empty();
    alias front = i;
    void popFront();
}

void main()
{
    foreach(n; S1()) { } // 2.086: Error: cannot infer argument types
    foreach(n; S2()) { } // 2.086: Error: cannot infer argument types
}
```

It's the `alias front` that is problematic.
Possibly related to https://github.com/dlang/dmd/pull/8437

--


More information about the Digitalmars-d-bugs mailing list