www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20606] New: Cannot cast non-mutable BitArray to void[],

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

          Issue ID: 20606
           Summary: Cannot cast non-mutable BitArray to void[], size_t[]
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: minor
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: moonlightsentinel disroot.org

BitArray's opCast does not work with const/immutable instances:

import std.bitmanip : BitArray;

void main() {
    BitArray m;
    const numbers = cast(size_t[]) m;
    const bytess = cast(void[]) m;

    // The following casts don't compile
    const BitArray c;
    const numbers = cast(const size_t[]) c;
    const bytess = cast(const void[]) c;

    immutable BitArray i;
    const numbers = cast(const size_t[]) i;
    const bytess = cast(const void[]) i;
}

--
Feb 24