Bug 24622 – Modify const data with void[] concatenation/append
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2024-06-21T12:48:24Z
Last change time
2024-06-21T15:57:54Z
Keywords
pull
Assigned to
No Owner
Creator
Nick Treleaven
Comments
Comment #0 by nick — 2024-06-21T12:48:24Z
Related to issue 17148.
void g(int*[] a, const(int*)[] b) @system
{
void[] va = a;
va[] = va.init ~ b; // a now contains b's data
*a[0] = 0; // modify const data
}
Appending a const array to void[] also needs to be disallowed.
typeof(void[] ~ const(void)[]) should be const(void)[], not void[].
Comment #1 by dlang-bot — 2024-06-21T13:47:39Z
@ntrel created dlang/dmd pull request #16606 "Fix Bugzilla 24622 - Modify const data with void[] concatenation/append" fixing this issue:
- Fix Bugzilla 24622 - Modify const data with void[] concatenation/append
https://github.com/dlang/dmd/pull/16606
Comment #2 by dlang-bot — 2024-06-21T15:57:54Z
dlang/dmd pull request #16606 "Fix Bugzilla 24622 - Modify const data with void[] concatenation/append" was merged into master:
- d8ecf576e77ab611668a344b961b5c4663818852 by Nick Treleaven:
Fix Bugzilla 24622 - Modify const data with void[] concatenation/append
https://github.com/dlang/dmd/pull/16606