D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6342 - Tuple field access problem in pure function
Summary: Tuple field access problem in pure function
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: x86 Windows
: P2 normal
Assignee: No Owner
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2011-07-18 01:45 UTC by bearophile_hugs
Modified: 2015-06-09 05:14 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description bearophile_hugs 2011-07-18 01:45:10 UTC
DMD 2.054:


import std.typecons;
Tuple!(int, "x") foo() pure {
    int y1 = foo().x;
    int y2 = foo()[0];
    return typeof(return)(0);
}
void main() {}


test.d(3): Error: pure nested function 'foo' cannot access mutable data '_field_field_0'
test.d(4): Error: no [] operator overload for type Tuple!(int,"x")
Comment 1 irritate 2013-06-18 16:07:19 UTC
Issue does not occur for me on head revision, DMD v2.064.
Comment 2 bearophile_hugs 2013-06-18 17:18:18 UTC
(In reply to comment #1)
> Issue does not occur for me on head revision, DMD v2.064.

Good. Closed.