www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20067] New: [REG2.086] foreach no longer works on range with

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 puremagic.com
          Reporter: johanengelen 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

--
Jul 21 2019