Bug 20610 – const in a .tupleof loop is ignored

Status
RESOLVED
Resolution
FIXED
Severity
critical
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2020-02-26T07:13:01Z
Last change time
2021-11-08T09:49:32Z
Keywords
pull
Assigned to
No Owner
Creator
Andrej Mitrovic

Comments

Comment #0 by andrej.mitrovich — 2020-02-26T07:13:01Z
----- void main () { struct S { int what; } S record; foreach (const ref field; record.tupleof) field = 10; } ----- This compiles fine. It also means that if you try to call a function with this field, it will not respect the 'const' and will allow you to modify the field.
Comment #1 by andrej.mitrovich — 2020-02-26T07:13:15Z
DMD 2.090.0
Comment #2 by dlang-bot — 2020-03-15T07:20:37Z
@BorisCarvajal created dlang/dmd pull request #10923 "Fix Issue 20610 - const in a .tupleof loop is ignored" fixing this issue: - Fix Issue 20610 - const in a .tupleof loop is ignored https://github.com/dlang/dmd/pull/10923
Comment #3 by dlang-bot — 2020-03-15T08:22:52Z
dlang/dmd pull request #10923 "Fix Issue 20610 - const in a .tupleof loop is ignored" was merged into stable: - 8fed09c99369578eadf4c036bc4b55a0bb5a4a78 by Boris Carvajal: Fix Issue 20610 - const in a .tupleof loop is ignored https://github.com/dlang/dmd/pull/10923
Comment #4 by boris2.9 — 2021-11-08T09:49:32Z
*** Issue 19341 has been marked as a duplicate of this issue. ***