www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17148] New: implicit conversion to void[] violates type system

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 puremagic.com
          Reporter: dfj1esp02 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.

--
Feb 05