← Back to index
|
Original Bugzilla link
Bug 24650 – foreach should support inout for callback delegate
Status
NEW
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2024-07-05T17:38:27Z
Last change time
2024-12-13T19:36:18Z
Assigned to
No Owner
Creator
apham
Moved to GitHub: dmd#20482 →
Comments
Comment #0
by apz28 — 2024-07-05T17:38:27Z
struct S { int opApply(int delegate(inout(int)) dg) { dg(1); return 0; } int opApply(int delegate(size_t, inout(int)) dg) { dg(0, 1); return 0; } } void main() { import std.stdio; S s; foreach(n; s) // error on this line writeln(n); } onlineapp.d(21): Error: variable `onlineapp.main.__foreachbody2.n` - `inout` variables can only be declared inside `inout` functions
Comment #1
by robert.schadek — 2024-12-13T19:36:18Z
THIS ISSUE HAS BEEN MOVED TO GITHUB
https://github.com/dlang/dmd/issues/20482
DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB