[Issue 13775] [REG2.067a] Broken explicit casting of dynamic array slices of known size to static array of different type

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Feb 11 22:21:37 PST 2015


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

Mathias LANG <pro.mathias.lang at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
                 CC|                            |pro.mathias.lang at gmail.com
         Resolution|FIXED                       |---

--- Comment #14 from Mathias LANG <pro.mathias.lang at gmail.com> ---
Vibe.d is suffering from it as well:
----
case AF_INET6:
    ubyte[16] ip = addr_ip6.sin6_addr.s6_addr;
    auto ret = appender!string();
    ret.reserve(40);
    foreach (i; 0 .. 8) {
    if (i > 0) ret.put(':');
        ret.formattedWrite("%x", bigEndianToNative!ushort(cast(ubyte[2])ip[i*2
.. i*2+2]));
    }
    return ret.data;
----

However this code still fails with a recent compiler:

source/vibe/core/net.d(181): Error: cannot cast expression ip[cast(ulong)(i *
2)..cast(ulong)(i * 2 + 2)] of type ubyte[] to ubyte[2]

Tested with "v2.067-devel-932e0a5" (From today, Feb 12).

--


More information about the Digitalmars-d-bugs mailing list