[Issue 17148] New: implicit conversion to void[] violates type system

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sun Feb 5 02:50:33 PST 2017


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

          Issue ID: 17148
           Summary: implicit conversion to void[] violates type system
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: dfj1esp02 at sneakemail.com

void f(int*[] a, const int*[] b)
{
    void[] a1=a;
    const void[] b1=b;
    a1[]=b1[];
    *a[0]=0; //modify const data
}

Probably void[] shouldn't be writable without an explicit cast to, say, byte[].
Pretty similar to issue 2095: cast to void[] here is an upcast and should add
const qualifier. If the data was allocated as void[] from the beginning, then
it may be writable.

--


More information about the Digitalmars-d-bugs mailing list