Thread overview
[Issue 19519] cannot determine length of MirException._payload at compile time
December 27
https://issues.dlang.org/show_bug.cgi?id=19519

Илья Ярошенко <ilyayaroshenko@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |CTFE, rejects-valid

--
December 27
https://issues.dlang.org/show_bug.cgi?id=19519

--- Comment #1 from Илья Ярошенко <ilyayaroshenko@gmail.com> ---
Recent DMD BETA and DMD nightly

--
4 days ago
https://issues.dlang.org/show_bug.cgi?id=19519

--- Comment #2 from Илья Ярошенко <ilyayaroshenko@gmail.com> ---
Reduced test case:


private enum maxMsgLen = 1;

class C
{
    private char[maxMsgLen] _payload = void;
}


void initilizePayload(ref return char[maxMsgLen] payload, scope const(char)[]
msg)
{
        payload[0 .. msg.length] = msg;
}

///
unittest
{
    bool func()
    {
        /// scope messages are copied
        auto m = new C();
        initilizePayload(m._payload, "msg");
        return __ctfe;
    }

    static assert(func() == 1);
}


===========


onlineapp.d(12): Error: cannot determine length of C([__void])._payload at
compile time
onlineapp.d(22):        called from here: initilizePayload(m._payload, "msg")
onlineapp.d(26):        called from here: func()
onlineapp.d(26):        while evaluating: static assert(cast(int)func() == 1)

--