[Issue 24622] New: Modify const data with void[] concatenation/append

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jun 21 12:48:24 UTC 2024


https://issues.dlang.org/show_bug.cgi?id=24622

          Issue ID: 24622
           Summary: Modify const data with void[] concatenation/append
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: nick at geany.org

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[].

--


More information about the Digitalmars-d-bugs mailing list