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: [email protected]
          Reporter: [email protected]

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

--

Reply via email to