Bug 9859 – Cannot use inout in delegate

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-04-02T07:23:00Z
Last change time
2013-07-29T14:02:31Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
doob

Comments

Comment #0 by doob — 2013-04-02T07:23:21Z
The following code fails to compile: void foo (inout int[] arr) { auto dg = { foreach (i, e ; arr) {} }; dg(); } void main () { auto a = [3, 4, 5]; foo(a); } Error message: main.d(9): Error: variable main.foo.__lambda1.__aggr1174 inout variables can only be declared inside inout functions main.d(9): Error: variable main.foo.__lambda1.e inout variables can only be declared inside inout functions
Comment #1 by henning — 2013-07-28T08:03:08Z
Comment #2 by github-bugzilla — 2013-07-29T14:02:22Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/95830234837da368f19be6ac4ed0ae2538ea2ecd fix issue 9859 - Cannot use inout in delegate https://github.com/D-Programming-Language/dmd/commit/874036c5847a8cd7ea84d3d74d5281a75fea90e2 Merge pull request #2399 from hpohl/9859 fix issue 9859 - Cannot use inout in delegate