[Issue 19519] cannot determine length of MirException._payload at compile time
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Feb 11 12:25:41 UTC 2019
https://issues.dlang.org/show_bug.cgi?id=19519
--- Comment #2 from Илья Ярошенко <ilyayaroshenko at 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)
--
More information about the Digitalmars-d-bugs
mailing list