Bug 11725 – [AA] Cannot dup const AA

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-12-11T07:02:21Z
Last change time
2024-12-13T18:15:06Z
Keywords
pull
Assigned to
No Owner
Creator
Jerry Quinn
Moved to GitHub: dmd#18736 →

Comments

Comment #0 by jlquinn — 2013-12-11T07:02:21Z
void foo() { const int[] aa = [1,2]; int[] bb = aa.dup; // Works const int[string] ia = ["a":1,"b":2]; int[string] ib = ia.dup; // Error } /home/jlquinn/dmd2/linux/bin64/dmd -c aabug.d aabug.d(7): Error: cannot implicitly convert expression (ia.dup()) of type const(int)[string] to int[string] Version 2.064.2 on Debian x86_64
Comment #1 by hsteoh — 2019-10-24T17:46:13Z
Still happens on git master (b70b154d716b681c242f7d5fb3a4cea9449d508d).
Comment #2 by dlang-bot — 2019-10-24T18:26:16Z
@quickfur created dlang/druntime pull request #2838 "Fix issue 11725: AA.dup should return mutable AA where possible." fixing this issue: - Fix issue 11725: AA.dup should return mutable AA where possible. Since the original AA has been duplicated, it should be safe to mutate the copy. No need to needlessly restrict the copy to be const too. https://github.com/dlang/druntime/pull/2838
Comment #3 by dlang-bot — 2024-10-09T10:42:05Z
@ntrel updated dlang/dmd pull request #16979 "Fix issue 11725: AA.dup should return mutable AA where possible" fixing this issue: - Fix Bugzilla 11725: AA.dup should return mutable AA where possible Since the original AA has been duplicated, it should be safe to mutate the copy. No need to restrict the copy to be const too. https://github.com/dlang/dmd/pull/16979
Comment #4 by robert.schadek — 2024-12-13T18:15:06Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18736 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB