Thread overview
[Issue 11535] CTFE ICE on reassigning a static array initialized with block assignment
Apr 21, 2014
Kenji Hara
April 21, 2014
https://issues.dlang.org/show_bug.cgi?id=11535

Kenji Hara <k.hara.pg@gmail.com> changed:

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

--- Comment #3 from Kenji Hara <k.hara.pg@gmail.com> ---
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.

--
April 21, 2014
https://issues.dlang.org/show_bug.cgi?id=11535

--- Comment #4 from github-bugzilla@puremagic.com ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/64c27cbdefcf63442dc75b5ffab0227475d60b43
fix Issue 11535 - CTFE ICE on reassigning a static array initialized with block
assignment

https://github.com/D-Programming-Language/dmd/commit/0a95cd474fe1d17ee88aa47552094bd8535fbd9e Merge pull request #3479 from 9rnsr/fix11535

Issue 11535 - CTFE ICE on reassigning a static array initialized with block assignment

--
April 21, 2014
https://issues.dlang.org/show_bug.cgi?id=11535

github-bugzilla@puremagic.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--