Bug 15004 – std.concurrency fails to compile when sending static array larger 32 byte
Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2015-09-02T18:54:05Z
Last change time
2019-12-14T09:59:05Z
Assigned to
No Owner
Creator
secondaryAccount
Comments
Comment #0 by secondaryAccount — 2015-09-02T18:54:05Z
http://forum.dlang.org/thread/[email protected]
Sending a static array larger than 32 Byte fails with the error (dmd 2.068, same with 2.066 based ldc, so probably no recent regression):
dmd/phobos/std/variant.d(633): Error: new can only create structs, dynamic arrays or class objects, not int[9]'s
dmd/phobos/std/variant.d(344): Error: new can only create structs, dynamic arrays or class objects, not int[9]'s
[...]
I tested this string[n], int[n] and byte[n] - if the array is 32 Byte or smaller, it works fine.
As the limit is the same, this is perhaps related to https://issues.dlang.org/show_bug.cgi?id=10740 (although the error message is different)
Test programm:
import std.concurrency;
import std.stdio;
void fun() {
receive((byte[33] data) { writeln(data);});
}
void main() {
byte[33] data;
pragma(msg, data.sizeof);
auto tid = spawn(&fun);
send(tid, data);
}