Bug 19341 – const is ignored in iteration over a tuple

Status
RESOLVED
Resolution
DUPLICATE
Severity
major
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2018-10-29T22:25:29Z
Last change time
2021-11-08T09:49:32Z
Keywords
accepts-invalid
Assigned to
No Owner
Creator
briancschott

Comments

Comment #0 by briancschott — 2018-10-29T22:25:29Z
struct S { double a = 0; double b = 0; double c = 0; } void main() { S s; foreach (const ref mVal; s.tupleof) { mVal = 1 / mVal; // mVal is const and this should not work. } }
Comment #1 by dfj1esp02 — 2018-11-01T12:01:28Z
Reduced: --- import std.typecons; void f() { auto t=tuple(1,2); foreach (const int v; t) { v = 0; } } ---
Comment #2 by boris2.9 — 2021-11-08T09:49:32Z
This was a duplicate of issue 20610. *** This issue has been marked as a duplicate of issue 20610 ***