Bug 6342 – Tuple field access problem in pure function
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2011-07-18T01:45:00Z
Last change time
2015-06-09T05:14:44Z
Keywords
rejects-valid
Assigned to
nobody
Creator
bearophile_hugs
Comments
Comment #0 by bearophile_hugs — 2011-07-18T01:45:10Z
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 by irritate — 2013-06-18T16:07:19Z
Issue does not occur for me on head revision, DMD v2.064.
Comment #2 by bearophile_hugs — 2013-06-18T17:18:18Z
(In reply to comment #1)
> Issue does not occur for me on head revision, DMD v2.064.
Good. Closed.