new static array

anonymous via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Sep 1 09:47:02 PDT 2015


Hello,

I tried to send a string[4] with std.concurrency:

import std.concurrency;
import std.stdio;
void fun() {
	receive((string[4] data) { writeln(data);});
}

void main() {
	string[4] data;
	auto tid = spawn(&fun);
	send(tid, data);
}

I got (dmd 2.068)
/usr/include/dmd/phobos/std/variant.d(633): Error: new can only 
create structs, dynamic arrays or class objects, not string[4]'s
[...]

with int[4] it compiles and runs. int[][4] fails. Is this a bug?

Simple workaround: send a slice.


More information about the Digitalmars-d-learn mailing list