Bug 20067 – [REG2.086] foreach no longer works on range with alias front

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2019-07-21T13:33:29Z
Last change time
2019-07-23T23:45:40Z
Keywords
industry, pull, rejects-valid
Assigned to
No Owner
Creator
johanengelen

Comments

Comment #0 by johanengelen — 2019-07-21T13:33:29Z
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 by dlang-bot — 2019-07-21T16:16:10Z
@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 by dlang-bot — 2019-07-23T23:45:40Z
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