D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 9859 - Cannot use inout in delegate
Summary: Cannot use inout in delegate
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords: pull, rejects-valid
Depends on:
Blocks:
 
Reported: 2013-04-02 07:23 UTC by Jacob Carlborg
Modified: 2013-07-29 14:02 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Jacob Carlborg 2013-04-02 07:23:21 UTC
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 2 github-bugzilla 2013-07-29 14:02:22 UTC
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