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

Kenji Hara <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull

--- Comment #3 from Kenji Hara <[email protected]> ---
Reduced test case:

struct Hash11535
{
    ubyte[6] _buffer;

    void put(scope const(ubyte)[] data...)
    {
        uint i = 0, index = 0;
        auto inputLen = data.length;

        (&_buffer[index])[0 .. inputLen-i] = (&data[i])[0 .. inputLen-i];
    }
}

auto md5_digest11535(T...)(scope const T data)
{
    Hash11535 hash;
    hash.put(cast(const(ubyte[]))data[0]);
    return hash._buffer;
}

static assert(md5_digest11535(`TEST`) == [84, 69, 83, 84, 0, 0]);


Compiler fix:
https://github.com/D-Programming-Language/dmd/pull/3479

Note that the OP code would not work because std.digest.md does not support
CTFE.

--

Reply via email to