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: nob...@puremagic.com
          Reporter: n...@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[].

--

Reply via email to