Send/Receive bug in std.concurrency with immutable(ubyte[]) ?

Vijay Nayar madric at gmail.com
Sun Aug 4 13:57:14 UTC 2019


import std.concurrency;
import std.stdio;

void testThread() {
   receive(
       (immutable(ubyte[]) data) => writeln("Got it!"),
       (Variant v) => writeln("Mismatch: ", v.type()));
}

void main() {
   immutable(ubyte[]) data = [1, 2, 3];
   auto tid = spawn(&testThread);
   send(tid, data);
}

The output of this program is:
   Mismatch: immutable(ubyte)[]

Why does calling send with data of type immutable(ubyte[]) get 
converted to immutable(byte)[] when it is called with 
std.concurrency's send() and receive().  Is this a bug?



More information about the Digitalmars-d mailing list