D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 20067 - [REG2.086] foreach no longer works on range with alias front
Summary: [REG2.086] foreach no longer works on range with alias front
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P1 regression
Assignee: No Owner
URL:
Keywords: industry, pull, rejects-valid
Depends on:
Blocks:
 
Reported: 2019-07-21 13:33 UTC by johanengelen
Modified: 2019-07-23 23:45 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description johanengelen 2019-07-21 13:33:29 UTC
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
Comment 1 Dlang Bot 2019-07-21 16:16:10 UTC
@Basile-z created dlang/dmd pull request #10206 "fix issue 20067 - [REG2.086] foreach no longer works on range with alias front" fixing this issue:

- fix issue 20067 - [REG2.086] foreach no longer works on range with alias front

https://github.com/dlang/dmd/pull/10206
Comment 2 Dlang Bot 2019-07-23 23:45:40 UTC
dlang/dmd pull request #10206 "fix issue 20067 - [REG2.086] foreach no longer works on range with alias front" was merged into stable:

- 2c28c6627dfcbbc90947ffb0e14acf0af273984a by Basile Burg:
  fix issue 20067 - [REG2.086] foreach no longer works on range with alias front

https://github.com/dlang/dmd/pull/10206